Write a statement that prints the number of characters

Assignment Help JAVA Programming
Reference no: EM13832212

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

Reference no: EM13832212

Questions Cloud

Write a program that prints the balance of an account : Write a program that prints the balance of an account after each of a number of years y, given an initial balance b and a yearly interest i, specified as a percentage (e.g., 5%). The values of y, b and i are all user-specified.
Compare and contrast li and xiangjun : 1. Compare and contrast Li and Xiangjun. In what ways are they similar?  In what ways are they different? What is the importance of their similarities and differences?
Deviant behavior is a natural disposition : Deviant behavior is a natural disposition. Which theoretical approach best explains deviant behavior? Support your opinion with factual information and explain your reasoning.What are the strengths and weaknesses of this approach?
Consider the following reaction that occurs at stp : Consider the following reaction that occurs at STP
Write a statement that prints the number of characters : Write a statement that prints the number of characters in a String object called myString. Write statements to prompt for and read user's age using Scanner variable
Analyze the case of the egyptian labor market : Use Demand and Supply tools to analyze the case of the Egyptian labor market
Development of capitalism and modern economic analysis : Markets have been present to some degree throughout history, but market society is fairly recent. What does Varoufakis argue was necessary for the development of capitalism and modern economic analysis?
Economists believe that the current values of the deposit : Economists believe that the current values of the deposit multiplier and the money multiplier are widely divergent. Why might these values differ at present? What (if anything) do you think must happen for them to converge once again?
Esper is a component for complex event processing : Esper is a component for complex event processing (CEP). We use Esper in this exercise to learn about stream database systems and complex event processing. The scenario used in the exercise is building a stock trading robot. The events (ticks) are..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a method named validate to help a local banker

write a method named validate to help a local banker. Your method will need to utilize two input parameters and the method's return value (for its output).

  Write a one-class java program

Write a one-class Java program with at least one method (besides main) to determine if the data in your dataset (i.e., in data.txt) follows Benford's law.

  Will the direction and magnitude be integers or doubles

Define a Physics_vector class which consists of a struct containing the direction and magnitude, and also define a function

  Create a world class that contains a 2d array

You have to create a world class that contains a 2d array then create an abstract class called organism that contains move() method the organism should move randomly one step at the time.

  Java program for creating a order menu

Assume your consulting company has been hired to construct a program that meets the following requirements.

  Critics of american often that teacher''s unions represent

Which organization has proposed a set of standards for both elementary level and secondary-level teachers? According to the latest info.,  teachers will be most needed in which of the following areas: Critics of American often argue that teacher's un..

  Graphics program that draws 12 strings

Write a graphics program that draws 12 strings, one each for the 12 standard colors, besides Color.WHITE, each in its own color. Provide a class ColorNameViewer and a class ColorNameComponent.

  Complete the method named countoutofrange

The element is greater than or equal to min AND less than or equal to max. The method should return the new array -

  Write a java program called salesinfominer

Write a Java program called SalesInfoMiner that reads in a file of products, stored in text format. The program must then read in information about past sales transactions and output all the products to a new file, sorted by product description,..

  Enhance the test score applicaion

Enhance the Test Score applicaion so it uses a "while" or a "do-while" loop plus a for loop - Change the while statement to a do-while statement, andtest this change. Does this work any better than the while loop?

  Write a scanner that translates logical expressions

Write a scanner that translates logical expressions. There are many different notations for logical expressions.

  Illustrate the power of java inheritance and polymorphism

Illustrate the power of Java inheritance and polymorphism. Your response to this question is in multiple parts. You will submit your answers as specified at the end of this question.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd