Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following UML class diagram is for a restaurant ordering system. Study the UML then answer the questions below: Order - int burgerQty - int

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

The following UML class diagram is for a restaurant ordering system. Study the UML then answer the questions below: Order - int burgerQty - int pepsiQty - int potato Qty -double burgerPrice -double pepsiPrice - double potato Price -int customerOrderNo -static int orderNo +Ordero +void createOrder( int burgerQty, int pepsiQty, int potato Qty, double burgerPrice, double pepsiPrice, double potato Price) +double calculatelnvoice O+boolean drawWinnero o+String to Stringo + boolean drawWinnero o+String toStringo a. Create a class "Order" with its member variables and methods. 1. Create an initialization constructor for the class "Order to initialize the class variables to empty values. (1 point) 2. Write a method createOrder() ,to fill the order details.( 2 point) 3. Write a method calculatelnvoice(). This method shall return the invoice total amount including 5% VAT. (3 points) 4. Write a method toString(). This method shall return the order details. (1 points) 5. Write a method drawWinner(). This method shall generate a random number between 1 to 1000, If the customerOrderNo is same as the generated random number, the customer will win a free order. (3 points) For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). BI S Paragraph Arial > V > I DE 14px > T RBC + QUESTION 2 4 points Save Answer B. Create a main class to test your Order class and do the following: 1. Declares two objects of type Order and set the data of the objects to some new data to be inserted from the keyboard. (1 point) 2. Display "Congratulations" if the customer won a free order and "Hard luck if not. ( 1 point) 3. Print the following order details for object1: (1 point) Burger quantity and price. Potato quantity and price. Pepsi quantity and price. Invoice total with and without tax. . 4. Display the total number of orders. (1 point) QUESTION 3 6 points Write a program for a vending machine which shall dispense items such as snacks, drinks, candy and, books, when a customer inserts coins inside the machine. Save Answer a. Create a JFrame Form VendingForm, that has 2 labels, four check boxes, two buttons, and two text fields. Your design shall look like the following: (1 point) Design Preview (VendingForm) ED Design Preview [Vending Form) Money Amount Money Amount 10.00 Change Change 3.5 PEPSI (1.5 dhms) SNICKERS (2.0 dhms) PEPSI (1.5 dhms) SNICKERS (2.0 dhms) WATER (1.0 dhms) PRINGLES CHIPS (4.0 dhms) WATER (1.0 dhms) PRINGLES CHIPS (4.0 dhms) Design Preview Vending Form) Design Preview [Vending Form] 0 Money Amount Money Amount Change Change PEPSI (1.5 dhms) SNICKERS (2.0 dhms) V PEPSI (1.5 dhms) 1. SNICKERS (2.0 dhms) WATER (1.0 dhms) PRINGLES CHIPS (4.0 dhms) V WATER (1.0 dhms) V PRINGLES CHIPS (4.0 dhms) Buy Clear Buy Clear b, The customer can colo Buy Clear Buy Clear b. The customer can select the item/s he wants to buy, then inserts the money amount in the 1st text field,then press the button Buy. After that the program shall display the change in the 2nd text field. (3 points) c. The button Clear" will clear all text fields and deselect the selected check boxes. (2 point) Submit the code inside the two buttons( Buy and Clear) only! Do not submit the JFrame design code

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions