Question: NameTester: import java.util.Scanner; public class NameTester { public static void main(String[] args) { //create a Scanner object. Scanner in=new Scanner(System.in); System.out.println(Please enter your first name);

NameTester:

import java.util.Scanner; public class NameTester { public static void main(String[] args) { //create a Scanner object. Scanner in=new Scanner(System.in); System.out.println("Please enter your first name"); String first = in.next(); String blank = " "; System.out.println("Please enter your last name"); String last = in.next(); String full = first + blank + last; System.out.println(full.substring(0,1)); System.out.println(full.substring(1,2)); System.out.println(full.substring(2,3)); System.out.println(full.substring(3,4)); System.out.println(full.substring(4,5)); System.out.println(full.substring(5,6)); System.out.println(full.substring(6,7)); System.out.println(full.substring(7,8)); System.out.println(full.substring(8,9)); System.out.println(full.substring(9,10)); } }?

must be in java:

Problem 5: This one you will also do on your own and it will be an adaptation of a problem from Lab 4.

Copy you class named NameTester form Lab4. (You will not need a class. This will have the main method in it).

Keep - Import Scanner

Keep - Create a Scanner object

Keep - Prompt for your first name.

Keep - Create a variable for your first and get the user input for your first name.

Keep - Prompt for your last name.

Keep - Create a variable for your last name and get the input for your last name.

Keep - Create a variable for a blank.

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

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

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!