Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Sql All In One For Dummies 7 Books In One

Authors: Allen G Taylor ,Richard Blum

4th Edition

1394242298, 978-1394242290

More Books

Students also viewed these Databases questions

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago