Question: Convert the MileConversions program to an interactive application. Instead of assigning a value to the miles variable, accept it from the user as input. This

Convert the MileConversions program to an interactive application. Instead of assigning a value to the miles variable, accept it from the user as input.

This is what I have but it is only 66% correct:

import java.util.Scanner; class MileConversionsInteractive { public static void main(String[] args) { final double INCHES_IN_MILE = 63360; final double FEET_IN_MILE = 5280; final double YARDS_IN_MILE = 1768; double miles; // Only need to declare the variable double in, ft, yds; Scanner sc = new Scanner(System.in); // Scanner declaration to accept input from user System.out.print("Enter miles: "); miles = sc.nextDouble(); // Accept number of miles

in = miles * INCHES_IN_MILE; ft = miles * FEET_IN_MILE; yds = miles * YARDS_IN_MILE; System.out.println(miles +" miles is " + in + "inches, or "+ ft + " feet, or " + yds +" yards"); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!