Write a statement that prints the number of characters in a


part 1:

1. Write a statement that prints the number of characters in a String object called myString

2. Write statements to prompt for and read user's age using Scanner variable

3. What does the following statement sequence print?

String str = "Harry";

int n = str.length();

String mystery = str.substring(0,1) + str.substring(n-1, n);

System.out.println(mystery);

part 2:

is to convert a person height in feet and inches to meter

for example
What is your name? Steve
What is your height?
Feet: 6
Inches: 4
Steve, your height in meters is 1.93

To convert the height to meters, you must first convert height from feet and inches to just inches. Then you can convert the inches to meters. Since there are 12 inches in a foot, 2.54 inches in a centimeter, and 100 centimeters in a meter, you can use one equation to do all the conversion:

Hm = ((Hf * 12) + Hi) * 2.54 / 100

where Hf is the number of feet entered by the user Hi is the number of inches entered by the user Hm is the height of the person in meters In the above example, Hf = 6, Hi = 4, and Hm = 1.93

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write a statement that prints the number of characters in a
Reference No:- TGS01112469

Now Priced at $40 (50% Discount)

Recommended (97%)

Rated (4.9/5)