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
Martin Luther King Jr., in his speech, encourages the blacks to work for the nation, rather than to take revenge with the Whites
tankabanditka [31]

Answer:

yes it will become true but now african are working for their nation

3 0
2 years ago
Which of the following are examples of prose? A. The Hunger Games book series B. The lyrics of a popular song C. A painting by M
lions [1.4K]

Answer:

A or C or E

i aplogise if I am not correct.

Explanation:

3 0
3 years ago
Directions: Let’s describe a big idea or event in one word. Read the topics and choose one for your focus. Share your answers in
vaieri [72.5K]

The word that can be chosen based on the information given in the Princess and the Goblin is conversation.

<h3>How to illustrate the information?</h3>

It should be noted that from the The Goblins,” Curdie overhears a conversation between the goblins.

It should be noted that a conversation is a dialogue that ensues between people. It should be noted that this is important in literature on order to move the plot forward.

Therefore, the word that can be chosen based on the information given in the Princess and the Goblin is conversation.

Learn more about the Princess and the Goblin on:

brainly.com/question/27876290

#SPJ1

4 0
1 year ago
Reimagine Narrative Planner
Vladimir [108]

Answer:

Oh my god you type so much

8 0
3 years ago
City of Embers
Otrada [13]

Answer:

2

Explanation:

5 0
3 years ago
Other questions:
  • Can you guts help me with my essay?? what is a rebuttal and what sentence in the rebuttal can i use in thr childrens story argum
    13·1 answer
  • Pleeease i need help ;(
    7·1 answer
  • Read these lines of poetry:
    14·2 answers
  • ANTONYM an ARTLESS young journalist
    5·2 answers
  • Is the underlined verb or verb phrase in the simple, progressive, perfect, or progressive perfect aspect?
    13·1 answer
  • Refer to your Expeditions in Reading book for a complete version of this text.
    15·1 answer
  • How do context, audience, and purpose influence the decisions we make as writers?
    6·1 answer
  • Does Douglass agree with the assessment of his fellow slaves?
    13·1 answer
  • Someone hellppp please :) i need someone to write a narrative story of a person helping a friend in need it’s 9th grade so famil
    6·1 answer
  • What is the definition of vocal prosody?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!