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
Which option is an example of pathos?
andrey2020 [161]

Answer: D. The story of a young boy who survived the Holocaust

Explanation:

7 0
3 years ago
Read 2 more answers
Who creates a computer virus? Why do they create computer Vins​
Nikolay [14]

Answer:

some of the reasons why people create computer viruses and other malware, and an explanation of each.

Damage and chaos. ...

An ego stroke. ...

Monetary or information gain. ...

Stealth. ...

Prevention.

Explanation:

4 0
3 years ago
Read 2 more answers
Write ONE compound sentence about winter holidays (christmas) with the conjunction ""for"".
Ilya [14]

Answer:

I go to my grandmas every year, for Christmas dinner.

Explanation:

You are taking the sentence " I go to my grandmas every year" and you are giving it an explanation using " for".

4 0
2 years ago
A driver's license, together with a bank card, _________ required for identification.
spin [16.1K]
A social security require for identification or birth certificate
5 0
3 years ago
Read 2 more answers
Mammals share three common characteristics. Mammals have hair for fur. Also, unlike reptiles, mammals are warm-blooded, which me
Firlakuza [10]
I think it's explanation since the text shows comparison which isn't direct, ni similar words are present, ruling out synonyms and examples aren't present in the text.
7 0
3 years ago
Other questions:
  • How does the author develop the central idea across these excerpts?
    11·2 answers
  • The following question references the novel The Three Musketeers by Alexandre Dumas.
    8·1 answer
  • Which excerpt from O’Connor’s “Good Country People” best reveals the irony of Joy’s name? Mrs. Hopewell thought of her as a chil
    7·2 answers
  • Describe how Mr. Brown treats the Igbo religion, and how that contrasts with Okonkwo's behavior towards Mr. Brown. The material
    13·1 answer
  • CAN SOMEONE HELP ME URGENTLY!!!!!!!!! 2) Choose the adjectives in the following sentence. In this case, do not count the article
    5·1 answer
  • If you were writing to the Rural Protection Agency, the letter might be about
    8·1 answer
  • Please paraphrase each stanza in the poem, On Quitting by Edgar Guest.
    9·1 answer
  • To what is Romeo referring in the phrase "holy shrine
    6·1 answer
  • Write each noun in the sentences below, and label it as C (common) or P (proper).
    14·1 answer
  • Which best describes a retelling?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!