hello i am stuk on this piece of work which i have no understaning at all!!! this is the question could someone please show me or give me gudlines in how to do it!!!

Write a Java application that asks a user for their name and displays it in a ‘box’ similar to that you implemented in week 1, exercise 1. For this application, you use a for loop to repeated printing * and space characters to result in the boundaries and padding, respectively. Below is what your application should produce.

Please enter your name> king 786

/********\
| |
| king 786 |
| |
\********/

The number of characters (* or space) is determined by the length of the name entered (hint: use String length method). Remember that you have to add 2 to this length in order to take into account the space either side of the name.

well, before you get torched I'll help...

but you know I'm not just going to give you the answer... ;)

first, condense what you know like this...

From: "Write a Java application that asks a user for their name and displays it in a ‘box’ similar to that you implemented in week 1, exercise 1. For this application, you use a for loop to repeated printing * and space characters to result in the boundaries and padding, respectively. Below is what your application should produce.

Please enter your name> king 786

/********\
| |
| king 786 |
| |
\********/

The number of characters (* or space) is determined by the length of the name entered (hint: use String length method). Remember that you have to add 2 to this length in order to take into account the space either side of the name."

to something like:

"
prompt userName,
display in ‘box’
use for loop with println
///Example:
Please enter your name> king 786
should return:
/********\
| |
| king 786 |
| |
\********/
(hint: use String length method). ...for spacing add 2 for either side
"

then do it...


Scanner keyboard = new scanner(System.in);

...

have fun

declare your variables then throw this in main: Don't forget I pseudocoded it...but this is downright simple to fix.

//prompt userName

println("Please enter your name> ");
nextLine();

//display in ‘box’

//first line
print("/")
for (count = 1; count <= name.length(); count++)
print("*")
println("\\");

//second line
println("| |");

//third line
println("| " + name + " |");

//fourth line
println("| |");

//fifth line
print("\\");
for (count = 1; count <= name.length(); count++)
print("*");
println("/");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.