Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are 12 inches in a foot and 3 feet in a yard . Create a class named InchConversion. Its main() method accepts a value

There are 12 inches in a foot and 3 feet in a yard.

Create a class named InchConversion. Its main() method accepts a value in inches from a user at the keyboard, and in turn passes the entered value to two methods. One converts the value from inches to feet, and the other converts the same value from inches to yards.

Each method displays the results with appropriate explanation.

This is what I have but is not working:

import java.util.Scanner;

public class InchConversion { public static void main (String args[])

{ Scanner sc= new Scanner(System.in); int inches= sc.nextInt(); convertToFeet(inches); convertToYards(inches); }

public static void convertToFeet(int inches)

{ System.out.println("One Feet equals 12 inches"); double inch=inches;

System.out.println("So,"+inches+" inches equals "+inch/12+" feet"); }

public static void convertToYards(int inches)

{

System.out.println("One Yard equals 3 feets or 36 inches"); double inch=inches; System.out.println("So,"+inches+" inches equals "+inch/36+" yards");

}

}

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions