Old 03-07-2014, 02:05 AM   #1 (permalink)
Status: Junior Member
Posts: 9

Default java hmwk help

Program 1: Identify Word

A team of archaeologists and linguists have recently discovered what they believe to be the lost relics of an
alien language. Coincidentally, this language has a similar alphabet to ours or, at least, one our team believes
can be mapped to ours. Because of this, the linguists have changed all of our data to be represented by English
letters that way they can use our expertise to create an automated system to assist them with their research.
They arent done diagramming the entire language, but so far they have been able to identify four parts of

? A florb is any word that starts and ends with different characters
? A wooble is any word that contains either the character pair pq or the character pair zt
? A zith is any word that contains a j and whose length is either a multiple of 3 or a multiple of 4.
? A zarf is any word which has a capital letter in the middle of the word.

Here is an example run of the program. For each of these examples, keep in mind that while it would appear
that there is an extra newline at the end, there isnt. That was put in manually to make the examples easier to
read. Also, user input is underlined. There is one space after the colon.

This is what i have so far.....

import java.util.Scanner;

public class IdentifyWord
public static void main(String[] args)

Scanner input = new Scanner(;
System.out.println("Please enter a word to be analyzed: ");
String word = input.nextLine();

if (word.charAt(0) != (word.charAt(word.length()-1)))
System.out.println("The word \'"+word+"\' is a florb"); // if start != end

else if (word.contains("pq"))
System.out.println("The word \'"+word+"\' is a wooble"); // if word has: pq, or zt
if (word.contains("zt"))
System.out.println("The word \'"+word+"\' is a wooble");

else if ((word.contains("j")) && (word.length()%3==0) && (word.length()%4==0))
System.out.println("The word \'"+word+"\' is a zith"); // if word has j and length is x3 or x4

else if (input.isUpperCase((word.length()%2 == 1))

/*(!(Character.isUpperCase(1)) || (!(Character.isUpperCase(word.length()-1))))*/
System.out.println("The word \'"+word+"\' is a zarf");

System.out.println("The word \'"+word+"\' is not one of the four parts of speech");

} // end of method main
} //end of public class

I am VERY FKIN CONFUSED with going about this problem using only indexOf, char, substrings, etc...... Apparently i cant use contains or character.isuppercase..... CAN SOMEONE OUTLINE ME A GUIDE HOW TO DO THIS PROBLEM?!

yishunshin is offline   Reply With Quote



Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java programming hmwk help. Done with overall, just need help on last part.? ace Billing Coding 0 09-16-2013 02:05 AM
c programming hmwk help? ace Programming 0 03-11-2013 03:04 AM
c programming hmwk (need help)? ace Coding 1 03-06-2013 09:04 PM
c programming hmwk (need help)? ace Coding 1 03-04-2013 06:06 AM
Beginner Java hmwk help!? Unknown_User Coding 3 01-30-2012 04:36 AM