Scanner object help | SoloLearn: Learn to code for FREE!

+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

12/1/2019 5:24:38 AM

Vanessa Liaw

11 Answers

New Answer

+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.

+5

Vanessa Liaw Why keyboard.equals here while(!keyboard.equals("QUIT")) { Here should be choice.equals

+3

Vanessa Liaw Ok but check my code once.

+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.

+2

Avinesh I think she want to take input till the program quit.

+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

0

It's hard to understand what you are looking for. It's just not clear.

0

so if i did while(choice.equals()), what goes in the switch()

0

does anyone know how a program should silently wait at the prompt for a command

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

0

i’ve save the changes