In this assignment, you are required to write a Java Application that uses an interactive Graphical User Interface (GUI) based on the JFrame class using SWING GUI components.
Your task is to develop a Java Application that allows the user to select a pizza and drink from an online pizza shop using the three drop down lists, calculate the cost of purchasing the selected pizza and drink and display the total cost including the delivery cost. The application should contain a GUI as shown below. The GUI components should consist of 1 Label, 3 Combo boxes/drop down lists (Select Pizza Type, Select Pizza Size, Select a Drink), 1 Text Area and 4 Buttons (Add Delivery Cost, Show Total Cost, Submit Order, Exit). The layout managers are not used in this assignment. The components should be in the same order as shown below. see image.
The functions of the four buttons are described below.
1. Add Delivery Cost
The Add Delivery Cost button adds $4 (a flat rate delivery cost) to total order. A message in text area should be displayed as follows. see image.
The pizza types, pizza sizes, drinks and costs are shown below in Tables 1-4.
Table 1. Large Pizza and Cost
Large Cost ($)
BBQ Meatlovers 9.00
Chicken and Feta 8.50
Hawaiian 8.90
Vegorama 8.70
Table 2. Medium Pizza and Cost
Medium Cost ($)
BBQ Meatlovers 8.00
Chicken and Feta 7.50
Hawaiian 7.90
Vegorama 7.70
Table 3. Small Pizza and Cost
Small Cost ($)
BBQ Meatlovers 7.00
Chicken and Feta 6.50
Hawaiian 6.90
Vegorama 6.70
Table 4. Drink and Cost
Drink Cost ($)
Juice 2.50
Water 1.00
Coke 3.00
Fanta 3.00
2. Show Total Cost
The Show Total Cost button displays the total cost for the selected pizza, drink and delivery (if selected) as shown below. see image.
3. Submit Order
The Submit Order button calculates the total order cost and displays an appropriate receipt as shown below. see image.
4. Exit
The Exit button should allow the user to exit from the application.
Your application must have two classes (Order and OrderApplication) as described below.
Order.java file
public class Order
{
//Declare variables, constants and data structures as needed
//Constructor
//Methods
}
OrderApplication.java file
//Import packages
public class OrderApplication
{
//Declare variables, constants and data structures as needed
//Constructor
//Method to create label, comboboxes, buttons and register action listeners
//Method to create panels and add components
//Inner listener classes for comboboxes and buttons with actionPerformed method
public static void main(String[] args)
{
}
}