java - Problems w/ recognizing inputs to do different tasks -


what trying when program asks if add student "would add student y/n?" , if y inputted let add , if input n take main menu of program. set y=1 , n=0 i'm trying figure out how program read y , know do.

public class teststudent {      public static void main (string[] args) throws ioexception     {           inputstreamreader isr = new inputstreamreader (system.in );             bufferedreader stdin = new bufferedreader( isr );           string check, tempstring, tempstring2, setname, getname, setscore, getscore;         int tempint, tempint2, y, n;         boolean quit = false;         y=1;         n=0;         student s1, s2, s3;         s1 = new student();         s2 = new student();         s3 = new student();                  {             system.out.println("a - add student, d - delete student, f - find student, h - help, s - scores, x - exit");             check = stdin.readline().tolowercase();             switch (check)             {                  case "a":                                     system.out.println("enter student's name");                     tempstring = stdin.readline();                     s1.setname(tempstring);                     system.out.println("would add student y/n?");                     tempstring = stdin.readline();                     if (y=1) {                         system.out.println("enter student's name");                         tempstring = stdin.readline();                     }                     s2.setname(check);                     s3.setname(check);                 break; 

first want add tolowercase tempstring assignment.

tempstring = stdin.readline().tolowercase(); if (tempstring.equals("y")) { 

this check string gave against y, version updated (= means assignment) variable weren't using.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -