  • Create a Scanner (note which line the user inputs and presses enter)• Asks the user to enter the number of feet• Calculates and prints the equivalent inches• 1 foot = 12 inchesSample Run:Enter the number of feet6 feet is equal to 72 inches

Question

• Create a Scanner (note which line the user inputs and presses enter)
• Asks the user to enter the number of feet
• Calculates and prints the equivalent inches
• 1 foot = 12 inches
Sample Run:
Enter the number of feet

6 feet is equal to 72 inches

Step 1

The algorithm for the program would be as below:

1. Prompt the user for the input
2. Accept the user input
3. Compute the inches from feet and assign it to a variable
4. Print the value of feet and inches as required.

We use the Scanner class from the util package of java to accept user input.

Step 2

The java program is given below:

import java.util.*;

public class FeetCalculator{

public static void main(String[] args) {

int feet,inch;

Scanner reader = new Scanner(System.in);

System.out.println("En...

Want to see the full answer?

See Solution

Want to see this answer and more?

Our solutions are written by experts, many with advanced degrees, and available 24/7

See Solution
Tagged in

Programing 