Question: Use java please The starting code now has a loop. (I promise we will learn about loops soon.) Inside the loop the program asks the
Use java please
The starting code now has a loop. (I promise we will learn about loops soon.) Inside the loop the program asks the user to type 2 characters: an old character and a new replacement for that character. These are both scanned into the string "change". One possibility is that they typed "quit". In Exercise 2 you are going to check for this, and if they did type "quit", the code below will print a message and then end the program using System.exit(); Test it out and make sure typing "quit" works. Exercise 3: (1 point) - check that they entered 2 characters Programs that accept user input often do a lot of input validation, and that is the case with this program. Now check that they entered 2 characters. // Exercise 3: check that they entered 2 characters if ( System.out.println ("Input should be 2 characters. Exiting."); System.exit(1); Test it out and make sure it works. Exercise 4: (1 point) - using . charAt() Now grab those 2 characters from the change string and put them into character variables. // Exercise 4: get the two characters into char variables char oldChar = char newChar = System.out.println("replacing " "oldChar + " with " + newChar)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
