+ 1

Scanner object help

Can someone help me understand how I would go by doing this coding with this requirement for my code below. For my code, I need my program to run silently until given input, and I am not sure how I would run silently until given input. Below is something I need to try to do, does anyone know how to do it. I have a code below that I did so far, i just need to do the following instruction below and I don’t know how to start?? “I need to make sure the main method accepts an amount of input appropriate to the chosen method after a choice is made (so, after a case has been selected). This means that within each case in your switch case block, you need to use the scanner to take in the fields that should be read. For add and remove, you'll need to accept input for the person, oldAddress, and newAddress, while for the mail case you only need the person and one address. It looks like you declared the variables for these uses already, so all it will take is assigning whatever the scanner reads to those variables before they're plugged into the mailSystem methods.” https://code.sololearn.com/cAzTZ403RkYV/?ref=app

1st Dec 2019, 5:24 AM
Vanessa Liaw
Vanessa Liaw - avatar
11 odpowiedzi
+ 2
choice is right but you can't use keyboard.equals because keyboard is object of Scanner class not a String and that object doesn't has equals method.
1st Dec 2019, 3:29 PM
A͢J
A͢J - avatar
+ 5
Vanessa Liaw Why keyboard.equals here while(!keyboard.equals("QUIT")) { Here should be choice.equals
1st Dec 2019, 6:15 AM
A͢J
A͢J - avatar
+ 3
Vanessa Liaw Ok but check my code once.
1st Dec 2019, 4:39 PM
A͢J
A͢J - avatar
+ 3
Pãplø ŸãSsiñê and عزيزنا واتهامه ميلاد ناجح Karolin Bibi Don't Spam anywhere otherwise you may get ban permanently. I know everyone are new but don't do anything like anywhere in Sololearn.
2nd Dec 2019, 7:05 PM
A͢J
A͢J - avatar
+ 2
Avinesh I think she want to take input till the program quit.
1st Dec 2019, 6:13 AM
A͢J
A͢J - avatar
+ 1
Why did you use !choice.equals("QUIT") in while loop it will never go inside loop when you enter QUIT. In this case your program will never terminate. Check this I tried to do like this. I don't know it is correct or not according to your requirement. https://code.sololearn.com/cm7vkbYBiz7p/?ref=app
1st Dec 2019, 4:10 PM
A͢J
A͢J - avatar
0
It's hard to understand what you are looking for. It's just not clear.
1st Dec 2019, 5:51 AM
Avinesh
Avinesh - avatar
0
so if i did while(choice.equals()), what goes in the switch()
1st Dec 2019, 3:06 PM
Vanessa Liaw
Vanessa Liaw - avatar
0
does anyone know how a program should silently wait at the prompt for a command
1st Dec 2019, 3:29 PM
Vanessa Liaw
Vanessa Liaw - avatar
0
I am supposed to use the scanner object in the program, but I am supposed to silently wait at the promot for a command, does anyone know how that works
1st Dec 2019, 3:32 PM
Vanessa Liaw
Vanessa Liaw - avatar
0
i’ve save the changes
1st Dec 2019, 4:24 PM
Vanessa Liaw
Vanessa Liaw - avatar