Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

demonstrate the importance of induction training.

Answered: 1 week ago