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
A negative pressure respirator brings fresh air to you through a hose.
Lelu [443]
A negative pressure respirator brings fresh air to you through a hose Does a negative pressure respirator brings fresh air to you?
If a leak develops in a pressure-demand respirator, the regulator sends a continuous flow of clean air into the facepiece, preventing penetration by contaminated ambient air. ... Negative-Pressure Airflow Negative-pressure respirators draw air into the facepiece via the negative pressure created by user inhalation. ( can I plz have brainliest I need 4 more to have a new rank)
7 0
2 years ago
Thesis about not supporting lying
g100num [7]

Answer:

Lies are obstacles that harm one's internal states of life which makes one unable to communicate with everyone. Topic Sentence: Although lies are used to avoid hurting one's relationship, they destroy the trust between people.

3 0
3 years ago
Identify the correct sentence.
salantis [7]
Your answer is d, because the man was speaking for himself :)
4 0
3 years ago
What is the academic word in this sentence?
evablogger [386]
Learn is the academic word
3 0
3 years ago
As a result, rockets were used in battles and were a common—although unreliable—weapon.
Digiron [165]
I believe the answer could be found in a file but 72737 sound correct hahaha
8 0
3 years ago
Other questions:
  • Write a letter to your brother describing about harmful effect of junk food​
    5·2 answers
  • I will give brainliest hurry
    5·1 answer
  • What are the central ideas of "Eileen Collins Is in Control"? Select the two correct answers. Collins had to struggle against ge
    13·2 answers
  • Suppose you are tanim, you have a friend named robot Sophia. She is good at English. On the other hand, you have a bit difficult
    8·1 answer
  • For Whom is “Your Laughter” written? the poet himself Matilde Urrutia Jesse James Rita Hayworth
    9·2 answers
  • What is the snynonyms or antonyms of Exchange purify Pollute propel
    15·2 answers
  • Which passage from the text best supports the answer to Question 3?
    12·1 answer
  • What did collapse and lava mean?​
    5·1 answer
  • 1. My brother ………… the dog for a walk at six o’clock every morning.
    10·2 answers
  • Boyd is writing a research paper on the history of professional basketball He has found a biography of professional basketball p
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!