Click here to Skip to main content
15,890,438 members
Home / Discussions / Java
   

Java

 
AnswerRe: how to create a chart from a database in android eclipse .. please help me :D Pin
jschell25-Mar-15 11:38
jschell25-Mar-15 11:38 
SuggestionRe: how to create a chart from a database in android eclipse .. please help me :D Pin
Richard Deeming26-Mar-15 3:00
mveRichard Deeming26-Mar-15 3:00 
QuestionProblem writing metadata to TIF file on Linux only Pin
wf-doug-6823-Mar-15 9:13
wf-doug-6823-Mar-15 9:13 
SuggestionRe: Problem writing metadata to TIF file on Linux only Pin
Richard MacCutchan23-Mar-15 22:29
mveRichard MacCutchan23-Mar-15 22:29 
GeneralRe: Problem writing metadata to TIF file on Linux only Pin
wf-doug-6824-Mar-15 1:38
wf-doug-6824-Mar-15 1:38 
GeneralRe: Problem writing metadata to TIF file on Linux only Pin
Richard MacCutchan24-Mar-15 1:49
mveRichard MacCutchan24-Mar-15 1:49 
GeneralRe: Problem writing metadata to TIF file on Linux only Pin
wf-doug-6824-Mar-15 9:48
wf-doug-6824-Mar-15 9:48 
QuestionJava - Multiple User Input Prompts - Help Needed Pin
Amer_Khalil22-Mar-15 11:18
Amer_Khalil22-Mar-15 11:18 
C#
/*
 * 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 display 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:
 * 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; i++){
           //  System.out.print(names[i] + " ");
             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] +".");//+ " or your name is " + names[0]);
             }
             /*
             if (names[i].equals("boy") && names[i].equals("store")){
                 System.out.println("You are right.");
             }
             */
             else{
                 System.out.println("No, " +name + ", that is not correct.");
             }
          break;
             // without this break...everytime the user will hit 'enter' it will print "Your name is not of the three"
             //this break statement will stop the program after the user inputs his response.
         }

         /*
          * In this 'second part', as long as the user inputs the nouns in 'proper order' when prompted (airplane...airport...New Jersey)
          * the program compiles as it should.  But if you put New Jersey first, or airport...it stops compiling.  The user cannot
          * enter anything after that.
          */
         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")){
            //while (!validInput){
                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")) {
                    //while (!validInput){
                        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.");
                    // userInput= userInputScanner.nextLine();
                 }

        }

     }

    }

AnswerRe: Java - Multiple User Input Prompts - Help Needed Pin
Richard MacCutchan22-Mar-15 21:58
mveRichard MacCutchan22-Mar-15 21:58 
Questionjava Pin
Member 1153610218-Mar-15 21:35
Member 1153610218-Mar-15 21:35 
AnswerRe: java Pin
jschell20-Mar-15 13:09
jschell20-Mar-15 13:09 
GeneralRe: java Pin
Member 1153610220-Mar-15 22:08
Member 1153610220-Mar-15 22:08 
GeneralRe: java Pin
Richard MacCutchan22-Mar-15 3:59
mveRichard MacCutchan22-Mar-15 3:59 
Questionjava access specifier Pin
javaPest16-Mar-15 5:43
professionaljavaPest16-Mar-15 5:43 
AnswerRe: java access specifier Pin
Richard MacCutchan22-Mar-15 0:03
mveRichard MacCutchan22-Mar-15 0:03 
Questiondata type Pin
Member 1152879816-Mar-15 1:39
Member 1152879816-Mar-15 1:39 
AnswerRe: data type Pin
javaPest16-Mar-15 5:38
professionaljavaPest16-Mar-15 5:38 
GeneralRe: data type Pin
Richard MacCutchan22-Mar-15 0:02
mveRichard MacCutchan22-Mar-15 0:02 
AnswerRe: data type Pin
Richard MacCutchan22-Mar-15 0:02
mveRichard MacCutchan22-Mar-15 0:02 
Questionupdate Pin
Member 1152879816-Mar-15 1:37
Member 1152879816-Mar-15 1:37 
QuestionNeed to improve performance Multi-Threading code Pin
Abhi_aec15-Mar-15 21:07
Abhi_aec15-Mar-15 21:07 
AnswerRe: Need to improve performance Multi-Threading code Pin
Eli Zaslavchik13-Apr-15 3:04
Eli Zaslavchik13-Apr-15 3:04 
QuestionCristal Report Pin
Manjeet Kumar Nai14-Mar-15 1:22
professionalManjeet Kumar Nai14-Mar-15 1:22 
Questionecc diffie hellman Pin
Member 1152168512-Mar-15 22:45
Member 1152168512-Mar-15 22:45 
AnswerRe: ecc diffie hellman Pin
Richard MacCutchan12-Mar-15 23:53
mveRichard MacCutchan12-Mar-15 23:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.