Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Follow the started java code below the directions The starter code contains 2-3 formatting errors; all code (including code beyond the section that

Follow the started java code below the directions 

image

 

  •  
  • The starter code contains 2-3 formatting errors; all code (including code beyond the section that students are required to complete to make the program functional) must comply with the formatting requirements.
  • Complete the one print statement in the convert() method to compute and output the converted feet and inches as shown below.
     
  • The program must be completed using only integer constants and variables. In other words, a decimal point should not be contained within the code.
  • The programmer must complete the code with exactly one print statement in the convert() method.
  • The programmer may not create additional variables.
  •  

SAMPLE OUTPUT:

=================================

Enter the number of inches:
14
 

14 inches is 1 feet, and 2 inches

==================


import java.util.Scanner; public class InchesToFeet { public static void main(String[] args) { }| // The 'convert()' method (called here from the main method) does all the //work! convert(); // This method asks the user for total inches and outputs the conversion to // feet and inches. public static void convert() { // Create a new Scanner to read in input from user Scanner scanner = new Scanner(System.in); // Prompt the user and then store their input in 'totalInches' System.out.println("Enter the number of inches: "); int totalInches = scanner.nextInt(); // Convert to feet and inches. // ex. If totalInches is 38, then the output would be: 38 inches is 3 feet, and 2 inches // The variable 'totalInches' is the number of inches the user has entered. // ??? INSERT YOUR CODE HERE } } // scanner.close(); //Close the scanner object.

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

Government and Not for Profit Accounting Concepts and Practices

Authors: Michael H. Granof, Saleha B. Khumawala

6th edition

978-1-119-4958, 9781118473047, 1118155971, 1118473043, 978-1118155974

More Books

Students also viewed these Programming questions