/* I 'COPIED' AND 'PASTED' THE CODE I HAVE WRITTEN SO FAR. PLEASE READ THE */ /* COMMENTS, I HAVE TRIED EXPLAINING WHAT I AM TRYING TO DO AND THE ERRORS */
/* I AM GETTING. */
/* THANK YOU IN ADVANCE FOR YOUR HELP */
/*
* I am trying to write a program for school children
* or anybody that needs help or wants to refresh their English grammer.
* The program will dislay a sentence on the screen, and ask the user to pick the nouns in the sentence. If they correctly pick
* the noun(s), they will prompted with something like, "Excellent Job!", if not they will be prompted to try again. This basic program
* displays the sentence, and ask the user to find the noun. If the user correctly identifies "one" noun, it displays,
* You are correct, the two nouns are boy and store.
* If the user does not provide the correct answer, it displays
* "No, that is not correct".
* I want to put a loop in here that will keep asking the user to try again until "all" the nouns are found. Also, how do I
* modify the program, so when the user inputs "one" noun, the program displays, that there are more nouns, and keeps
* prompting the user to find the remainder of the nouns.
*
* I started this small project to help my daughter and some of her classmates that are having difficulties with "nouns",
* "pronouns", "verbs"....etc
* Once I get a good understanding of this code, I will expand to pronouns, verbs, adverbs,etc...
*
* The program is in "Two Parts"...the first part I used a String Array...for the second part I used nested if loops. No special
* reason for the "two part" program. I am trying to learn as I go along, that is the reason for trying different methods.
*
* Any help anyone may be able to provide will be greatly appreciated. You may also contact me via my personal email
* at: xxxxxxxxxxx@ymail.com
* Once again, Thank you for your help.
* One more thing, I used Eclipse Luna to write and compile this program.
*/
import java.util.Scanner;
public class BasicEnglishGrammer1 {
public static Scanner userInputScanner;
public static void main (String args []) {
userInputScanner = new Scanner(System.in);
String userInput = new String (" ");
String name = new String (" ");
System.out.println("\n");
String names [] = {"The", "boy","went","to","the","store"};
System.out.println("Hello, what is your name?");
name =userInputScanner.nextLine();
System.out.println(name + ", can you tell me what the nouns are in the sentence: ");
System.out.println("");
System.out.println("The boy went to the store.");
for(int i=0; i <names.length;>
names[i]=userInputScanner.nextLine();
if (names[i].equals("boy") || names[i].equals("store")){
System.out.println("You are right, " + name +" the two nouns are " + names[1] + " and " + names[5] +".");
}
else{
System.out.println("No, " +name + ", that is not correct.");
}
break;
}
System.out.println("");
System.out.println(name + " ,find the nouns in this sentence: ");
System.out.println("The airplane landed at the airport in New Jersey.");
userInput = userInputScanner.nextLine();
if (userInput.equals ("airplane")){
System.out.print("Great job "+ name + " there are two more nouns, can you find them?");
System.out.println("");
userInput= userInputScanner.nextLine();
if (userInput.equals("airport")) {
System.out.println("Great job, can you find one more?");
userInput= userInputScanner.nextLine();
}
if (userInput.equals("New Jersey")){
System.out.println("Excellent Job! "+ name +" do you know that 'New Jersey' is also a 'proper noun'?");
System.out.println("Remember that a 'proper noun' is the NAME of the person, place or thing.");
}
}
}
}