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
In Ovid's “Pyramus and Thisbe,” why are the jaws of the lioness bloody?
Yakvenalex [24]
B. She has just made a kill.
7 0
2 years ago
Read 2 more answers
Odysseus describes the home of the Cyclopes as having abundant fertile land that could be farmed, natural harbors and plentiful
djyliett [7]

your answer is.... Ç

3 0
3 years ago
How long should a statement of the main idea be
Ad libitum [116K]
Depends on the person who is teaching and if it is a 21 word thingy or it may be a paragraph.
4 0
3 years ago
20) Look at the underlined section marked (18). Choose the answer that best
denpristay [2]

Answer:

B)

Proper nursing is especially important, so cubs and

kittens are never given milk while they are lying on

their back

Explanation:

4 0
3 years ago
In this section of reading, Jem is proud of Atticus because ____. Atticus is a great shot Atticus is decent and humble Atticus s
Andreas93 [3]

Answer: atticus saved the neighborhood

6 0
3 years ago
Other questions:
  • What is the author's purpose for writing this text? A to compare the life of a woman to that of a man B to describe the perfect
    11·1 answer
  • HELP IM SOOOOO LOST I'LL GIVE A BRAINLIEST TO BEST ANSWER
    13·1 answer
  • A person who is not a resident of a country
    6·2 answers
  • Read the stanzas below from the poem “Ballad of Birmingham” by Dudley Randall and answer the question that follows.
    12·2 answers
  • What are differences between judge horton to atticus finch
    14·2 answers
  • Which diagram accurately reflects how a historical society influenced the modern U.S. government?
    11·2 answers
  • How do harrison’s parents react to what has happened on television?
    12·1 answer
  • Which of the following statements are true about this function: f(x)=sin x - 3
    15·1 answer
  • Explore how Shakespeare presents the attitudes of
    6·2 answers
  • Prompt
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!