Question: use java Problem 4: Your name in lights 25 pts Write a program to read a name from the console. The name variable should be

use java use java Problem 4: Your name in lights 25 pts Write a

Problem 4: Your name in lights 25 pts Write a program to read a name from the console. The name variable should be of type String, and use the nextLine() method of the Scanner to read it. If you use the next() method, it will only read up to the first blank space and we want to get the entire name. Print the name surrounded by stars. For example, if the input was "James Gary", then your program would print: ****** * James Gary * ************** You want your program to work for ANY name, so you need to determine how many characters are in a string. Fortunately, the Java String class has a method to do exactly that. Assuming your variable is called "name", name.length() will return the number of characters as an integer. In our example, name.length() would return 10 because there are 10 characters in "James Gary" (the space counts just like any other character

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!