ing Exercise 3-7 structions InchConversio.... There are 12 inches in a foot and
ID: 3745261 • Letter: I
Question
ing Exercise 3-7 structions InchConversio.... There are 12 inches in a foot and 3 feet in a yard 1 import java.util.scanner; 2 public class InchConverston C 3 public static void main (string argsti) ( Create a class named InchConverston . Its natn() 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. 10 6 public static void convertToFeet(int inches) // Write your code here 9- public static void convertToYards(int inches) /I Write your code here Each method displays the results with appropriate explanatiorni. 12 13 Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade. Once you are happy with your results, click theExplanation / Answer
import java.util.Scanner; public class InchConversion { public static void main(String[] args) { Scanner in = new Scanner(System.in); int inches = in.nextInt(); convertToFeet(inches); convertToYards(inches); } public static void convertToFeet(int inches) { System.out.println(inches + " inches is " + (inches/12.0) + " feets."); } public static void convertToYards(int inches) { System.out.println(inches + " inches is " + (inches/36.0) + " yards."); } }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.