Display a message dialog similar to the one shown in


Download VendingChange.java (above). Run it and become familiar with the output. Essentially, you need to create a user friendly GUI app using the code parameters of VendingChange.

Turn VendingChange.java into a GUI app.

1) Your program must display the input dialog.

2) You must check that the data entered by the user follows the required input. If not, your program must display an error dialog and exit.

3) If the input is valid, then your program must display a message dialog similar to the one shown in listing 2.12, but the message must pertain to VendingChange and not ChangeMaker. Your message dialog must show the number of pennies, nickels, dimes and quarters.

4) Your program must exit when the user closes the output message dialog.

5) Comment and document your program.

Complete the programming problems such that they produce output that looks similar to that shown in the text or upcoming class presentations (in-class and Announcements). Tips and formulas (if any) will be discussed in class. Additional details will be provided in class and Announcements.

add comments to code please.

instruction number 2 is really important please

import java.util.Scanner; public class VendingChange { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter price of item"); System.out.println ("(from 25 cents to a dollar, in 5-cent increments)"); int originalAmount = keyboard.nextInt(); int change = 100 - originalAmount; int quarters = change/25; change = change%25;// remaining change after deducting quarters int dimes = change/10; change = change%10;// remaining change after deducting dimes, too int nickels = change/5; change = change%5; int pennies = change; //The grammar will be incorrect if any of the values are 1 //because the required program statements to handle that //situation have not been covered, yet. System.out.println ("You bought an item for " + originalAmount + " and gave me a dollar,"); System.out.println("so your change is"); System.out.println(quarters + " quarters,"); System.out.println(dimes + " dimes, and"); System.out.println(nickels + " nickel."); } }

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Display a message dialog similar to the one shown in
Reference No:- TGS02885036

Expected delivery within 24 Hours