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
Step: 1
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-text-image.webp)
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](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp)
Step: 3
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp)
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started