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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago

Question

Detailed note on the contributions of F.W.Taylor

Answered: 1 week ago

Question

5. Identify the logical fallacies, deceptive forms of reasoning

Answered: 1 week ago

Question

6. Choose an appropriate organizational strategy for your speech

Answered: 1 week ago