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
NEED THIS ANSWER NOW!
makvit [3.9K]

Flawless means without faults

6 0
2 years ago
Read 2 more answers
How does Juliet surprise her parents? *
Vadim26 [7]
By agreeing to marry Paris
3 0
3 years ago
It is timeddddddd thank you!
irina [24]
Your marriage will be a complete disaster
5 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
What is an example of sacrifice in act 5 of merchant of venice by shakespeare
Gelneren [198K]

Answer:

As always, Shakespeare makes use of a good deal of blank verse, which is to say unrhymed iambic pentameter. The verses in the caskets and the comments of Morocco and Aragon thereon are in trochaic tetrameter, without the weak beat of the last trochee, as Dum-da Dum-da Dum-da Dum. The rhythm of "Tell me where is fancy bred" is similar: it may be scanned as iambic tetrameter as well as trochaic.

Hopefully thats what ur looking for, hope this helps!!!

4 0
3 years ago
Other questions:
  • How is the phenomenon of "Keeping up with the Joneses" a distinctly American concept?
    11·2 answers
  • Differences between practical and speculative principles
    9·1 answer
  • What kind of complement is the underlined word?
    7·2 answers
  • Blank is one of the most important life skills all parents should teach their children, as it helps children to learn how to con
    7·1 answer
  • Which topic is too broad for a cause-and-effect essay?
    13·2 answers
  • Which of the following is a gothic element in the prologue of Wuthering Heights?
    10·1 answer
  • We are using markers or pencils choose the correct punctuation ( . , ! ?)
    5·2 answers
  • What should the writer of this letter do before sending her letter?
    5·2 answers
  • Select all that apply.
    12·2 answers
  • How does the second stanza contribute to
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!