Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

One foot equals 1 2 inches. The following program intends to read a floating - point value from input, convert the value from inches to

One foot equals 12 inches. The following program intends to read a floating-point value from input, convert the value from inches to feet, and output the length in feet, but the code contains three errors. Find and fix all three errors.
Ex: If the input is 1.2, then the output is:
0.100 feet
import java.util.Scanner;
public class Inches ToFeet {
public static void main(String[] args){}
Scanner scnr= new Scanner(
System.in);
// Modify the following code
int lengthInches;
int lengthFeet;
lengthInches = scnr . nextInt () ;
lengthFeet = lengthInches ?12;
System.out.printf("%.3f feet ??
, lengthFeet);
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago