Get Academic Help Instantly!

CISS 100 RU Dialog Boxes from The Console Window Program


I’m stuck on a Java question and need an explanation.

5-8. Modify exercise 2-4 where miles per gallon where calculated from the console window. Now modify the program so dialog boxes are used (use all arguments). The prompt and input will be a dialog box instead of a System.out.print() and sc.nextDouble(). The output will be a dialog box instead of a System.out.println(). The input and output will all be the same, but now in dialog boxes. Save as and submit it.

 * Exercise 2-4
 * This program will calculate miles per gallon
 * */
import java.util.Scanner;
public class ex24
  public static void main(String[] args)
    double miles, gallons, mpg;				// declare variables
    Scanner sc = new Scanner(;

    System.out.print("Enter miles:  ");		// prompt
    miles = sc.nextDouble();				// input
    System.out.print("Enter gallons:  ");
    gallons = sc.nextDouble();

    mpg = miles / gallons;					// calculate

    System.out.printf("Miles per gallon is %.1fn", mpg);  // output


10% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET10 to claim 10% Discount This Month!!

Why US?

100% Confidentiality
100% Timely Delivery
100% Original Writing

100% Money Back

Cheap Essay Writing

Do my Assignment

Order custom essay

Sample Essays

Custom term paper

Write My Research Paper

Affiliate program

Custom essay

Research paper

Write my essay

Write my paper

Essay writers

Become a Freelance Writer

Contact us



Terms and conditions

Privacy policy

Proficient Concepts  is a professional writing service that provides original papers. Our products include academic papers of varying complexity and other personalized services, along with research materials for assistance purposes only. All the materials from our website should be used with proper references.