Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA Assume that the Scanner class has been imported. Do not write any import statements 1.) Declare a variable of tvpe String that is called
JAVA
Assume that the Scanner class has been imported. Do not write any import statements 1.) Declare a variable of tvpe String that is called response and initialise its value to an empty string. 2.) Declare a variable of tvpe boolean called exit and initialise its value to false 3.) Declare a variable of tvze Scanner called scanner 4.) Create a new Scanner abjet to read from System.in 5.) Write a loop that prompts the user to enter a name Each time the loop runs it should print to the console: Enter a name: read in the name and store it into a temporary variable You are free to call the variable anything you like) 6.) The loop should continue to prompt the user for another name until the user tvpes in 'finished (assume the user will enter a single word with no space 7.) For each iteration of the loop you should concatenate the name entered to the response yariable, adding a space between each name 8.) If the user enters finished', the loop should exit and print the users full name to the console. The name entered was: [value of all the names entered]. Example: Enter a name:Paul Enter a name:William Enter a name: Walker Enter a name:finished The name entered was: Paul William Walker 1 of 1: Wed Aug 15 2018 16:51:12 GMT+1000(Australian Eastern Standard Time) SUBMIT 1 Type your solution hereStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started