Question: This is java and please must follow the instruction and must put //(comment) and make simple program. Thank you a) Create a class called NameTester.

This is java and please must follow the instruction and must put //(comment) and make simple program. Thank you

a) Create a class called NameTester. (You will not need a class. This will have the main method in it).

b) Import Scanner

c) Create a Scanner object

d) Prompt for your first name.

e) Create a variable for your first and get the user input for your first name.

f) Prompt for your last name.

g) Create a variable for your last name and get the input for your last name.

h) Create a variable for a blank.

i) Create a variable for your full name and assign it your first and last name and a blank using the + operator.

j) Using the variable for your full name, use the substring method (use the table on page 159) as a guide) print out your name with one letter on each line. This should be accomplished using a loop. Remember you can get the length of the string from the method .length(). If you do not use a loop, you will not get credit.

M S . W

This is java and please must follow the instruction and must put

Table 7 String Operations Statement Result Comment string str"Ja" str str"va" str is set to "Java" When applied to strings,+ denotes concatenation. System.out.println( Please" rints Please enter your name: team is set to "49ers" se concatenation to break up strings that don't fit into one line. +enter your name: B erted ecause "ers" is a string, 49 is conv to a string. team49 "ers" String first in.nextO String last in.nextO; (User input: Harry Morgan) first contains "Harry"The next method places the next word last contains "Morgan" into th e string variable. Each space counts as one character. String greeting "H &S; int n greeting.1engthO n is set to 5 This is a char value, not a String. Note that the initial position is 0. ch is set to 'a" String str "Sal1y"; char ch str.charAt (1); str2 is set to "all" Extracts the substring starting at String str "Sal1y" String str2 str.substring(1, 4); 1 and ending before position 4 Position If you omit the end position, all characters from the position until the end of the string are inclu str2 is set to "ally" String str "Sal1y" String str2 str.substring(1); ded. Extracts a String of length 1; contrast with str.charAt (1) str2 is set to "a" String str "Sal1y" String str2 str.substring(1, 2); String last str.substring last is set to the stringThe last character has position containing the last character in str str.lengthO -1); str.lengthO - 1

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!