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
Based on the highlighting, what is the author’s purpose in this passage?
expeople1 [14]
Sim te konnel m ta diw Zoe
6 0
3 years ago
Read 2 more answers
The Song of Solomon should only be interpreted literally. True or False
Nimfa-mama [501]
Yes it true gfgftkdktydity
7 0
3 years ago
Visit a woman who is famous in your community.ask her question how she was able to attend school and the struggle struggle she m
Advocard [28]

Answer:

explain you after some time this was super ?

Explanation:

but you have give a 100 point me explain very very good all of subject

7 0
3 years ago
Apollo is the name of the Greek God of the sun and of knowledge. Which sentence best explains why the United States used this na
Fudgin [204]

Answer:

It's B

Explanation:

8 0
2 years ago
Where would I put a comma in the sentence my mother my cousin and I went to the store together
Aloiza [94]
It would go Like My mother, My cousin, and I
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which sentence from the text of "The Bet" best expresses the banker's development in the story?
    10·2 answers
  • Read the sentence below:
    13·2 answers
  • Your study area should be _____.<br><br> fun<br><br> softly lit<br><br> quiet<br><br> stimulating
    14·2 answers
  • Mary's father has five daughters
    15·2 answers
  • A character would face increasing obstacles in the
    12·1 answer
  • What's the cause of the initial clash between the British and the French ??
    13·1 answer
  • ASAP!!!
    10·1 answer
  • Why students should get back to the schools?
    7·1 answer
  • Select the correct text in the passage.
    15·2 answers
  • What was the cultural impact that took place due to the Silk Road
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!