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
What is the challenge in the book called The House on Mango Street?
Aleksandr-060686 [28]
The struggle for self-definition is a common theme in a coming-of-age novel, or bildungsroman, and in The House on Mango Street, Esperanza's struggle to define herself underscores her every action and encounter.
7 0
4 years ago
Place the structural elements of an argument in the order in which they should appear in an argumentative essay.
marta [7]

Answer:

claim

data

counterclaim

warrant

rebuttal

Explanation:

hope this helps!

6 0
3 years ago
What effects did the voting rights act have ?
notka56 [123]

The Voting Rights Act of 1965, signed into law by President Lyndon B. Johnson, aimed to overcome legal barriers at the state and local levels that prevented African Americans from exercising their right to vote as guaranteed under the 15th Amendment to the U.S. Constitution.


3 0
4 years ago
Please help me as ASAP
docker41 [41]

Answer:

C

Explanation:

i hope this helps i may be wrong

3 0
3 years ago
Which of the following is the proper order in which you should wash your
leonid [27]

Answer: D

Explanation: Always wet your hands first

6 0
3 years ago
Other questions:
  • How does the characterization of the children create satire? They are curious about what is in the garden. They are pleased to l
    13·2 answers
  • Which two quotes support the idea that Alfonso is delighted for Salvadore?
    15·1 answer
  • Read the excerpt from "Broken Chain.” "Ponytails! Those girls who messed with Frostie and me had ponytails. Is she cool?” "I thi
    11·2 answers
  • Can u guys make a sentence for each of the words
    13·1 answer
  • Which type of informational text includes biographical stories that tell about real events?
    8·1 answer
  • Which sentence describes how peers can impact your learning during a collaborative discussion?
    12·2 answers
  • Select the sentence where the word “hot” correctly modifies the word “chowder.”
    15·2 answers
  • 4 A Did you
    5·2 answers
  • Which strategy requires you to write ideas about your topic and narrow it down as you go?
    13·1 answer
  • A story about something that has happened in the past or about someone from the past is often called a _______________.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!