Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

explain communication for professionalism and management?

Answered: 1 week ago

Question

1. Describe the factors that lead to productive conflict

Answered: 1 week ago