1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sidana [21]
2 years ago
8

Write a java program that prompts the user to input a length expressed in centimeters. The program should then convert the lengt

h to inches (to the nearest inch) and output the length expressed in yards, feet, and inches, in that order (all three formats). For example, suppose the input for centimeters is 312. To the nearest inch, 312 centimeters is equal to 123 inches. So 123 inches would then be output as 3 yards, 1 foot, and 3 inches It should not output as: 2 yards, 4 feet and 3 inches = 10 feet, 3 inches = 10.25 feet.
English
1 answer:
lilavasa [31]2 years ago
7 0

The program is an illustration of a sequential program

<h3>What are sequential programs?</h3>

Sequential programs are programs that do not require loop or iteration

<h3>The main program</h3>

The program written in Java, where comments are used to explain each line is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

 //This creates a Scanner object

 Scanner input = new Scanner(System.in);

 //This prompts the user for length in cm

 System.out.print("Length (cm): ");

 //This gets the input for length

 int lengthCM = input.nextInt();

 //This converts the length to inches

 int lengthInches = (int)(Math.round(lengthCM/2.54));

 //This converts the length to yards

 int lengthYard = lengthInches/36;

 //This converts the remaining length to feet

 int lengthFeet = (lengthInches -36 * lengthYard)/12;

 //This calculates the remaining inches

 lengthInches = lengthInches - lengthYard * 36 - lengthFeet * 12;

 //This prints the required output

 System.out.print(lengthYard+" yards, "+lengthFeet+" feet and "+lengthInches+" inches");

}

}

Read more about sequential programs at:

brainly.com/question/17970226

You might be interested in
I need a acrostic with the word prospect
BlackZzzverrR [31]
The possibility or likelihood of some future event occurring. (Do you mean the meaning of the word, or do you want me to write it “acrostic” like make it a poem?
6 0
3 years ago
05. Write the following sentences in past tense.
IgorLugansk [536]

Answer:

1. I had some money.

2. She sang songs well.

3. they were playing cricket.

4. You had given the money.

5. He had to speak English

6. There was a man under the tree.

7. She could pass the exam.

8. They went on a trip.

9. This table helped us for a long time.

5 0
3 years ago
Read 2 more answers
When Marty and I came home from school, we were shocked. There were streamers, and people, and gifts, and it was a huge surprise
beks73 [17]

Answer:

a) me

Explanation:

When Marty and I came home from school, we were shocked. There were streamers, and people, and gifts, and it was a huge surprise. The party was for my brother and <u>me</u>. Hence, the option (a) is the correct answer.

3 0
2 years ago
Read 2 more answers
50 POINTS<br><br> Help me, Please?
BaLLatris [955]
I dont think i can answer the first few, but i can answer 4. and 5.

For number 4. it is 'The ferocious lion roared at the helpless zebra'

And for number 5. it is 'Study how to brush and shoe horses'

Hope this helps you!

6 0
3 years ago
Read 2 more answers
Why does thompson refer to the war of the worlds as a prescient classic
lana [24]
The correct answer to the question that why does Thompson refer to the war of the worlds as a prescient classic is that Thompson foresaw that it will reveal the way politicians will use mass communication's power to manipulate the public. Thank you for posting your question. I hope this answer helped you. Let me know if you need more help. 
8 0
3 years ago
Other questions:
  • Do some creative writing about something good that have happen about you
    9·1 answer
  • Reread the highlighted stanza. What two things are compared in a
    14·2 answers
  • Identifying what you will need to review takes place during_________ a. Surveying c. 2nd read through b. 1st read through d. Non
    11·2 answers
  • Enkidu said, "Don't worry, my friend, the dream you had is a favorable one. The eagle that you saw, with a lion's head, stands f
    8·1 answer
  • HELPPP!!!! ASAPPP!!!!
    7·2 answers
  • 6. Who is the leader of the mob outside the courthouse? In to kill a mockingbird
    14·1 answer
  • What is something we can<br> infer about Beatrice's<br> character based on?
    10·1 answer
  • PLEASE HELP THIS IN"T MY WORK BUT I'M USING MY SISTERS ACCOUNT Write the word saw or seen on each blank line to correctly comple
    15·1 answer
  • Which of the following education
    5·1 answer
  • 17. Which plural noun is spelled<br> correctly?<br> geeses<br> peoples<br> lilyes<br> benches
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!