Question: in the picture is a solution I need b solution please ,Thank you import java.util.ArrayList; import java.util.Collections; import java.util.Date; class PizzaOrder implements Comparable (private String

 in the picture is a solution I need b solution please

in the picture is a solution I need b solution please ,Thank you

import java.util.ArrayList; import java.util.Collections; import java.util.Date; class PizzaOrder implements Comparable (private String customerName; private Date dateOrdered; final static int SMALL = 1, MEDIUM=2, LARGE = 3; private int pizzaSize; private int numberOfToppings; private double toppingPrice; public PizzaOrder() () public PizzaOrder(String customerName, int pizzaSize, int numberOfToppings, double toppingPrice) { this.customerName = customerName; this.pizzaSize = pizzaSize; this.numberOfToppings = numberOfToppings; this.topping Price = toppingPrice; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public Date getDateOrdered() { return dateOrdered; } public void setDateOrdered(Date dateOrdered) { this.dateOrdered = dateOrdered; } public int getPizzaSize() { return pizzaSize; } public void setPizzaSize(int pizzaSize) { this.pizzaSize = pizzaSize; } public int getNumberOfToppings() { return numberOfToppings;) public void setNumberOfToppings (int numberOfToppings) { this.numberOfToppings = numberOfToppings; } public double getToppingPrice() { return toppingPrice; } public void setToppingPrice(double toppingPrice) { this.toppingPrice = toppingPrice; } public double calculateOrderPrice() { return (numberOfToppings topping Price) pizzaSize; } public void printOrderinfo() { System.out.println(customerName+":" calculateOrderPrice()); } @Override public int compareTo(PizzaOrder o) { return Double.compare(calculateOrderPrice(). o.calculateOrderPrice()); } @Override public String toString() { return "PizzaOrder(" + "customerName="" + customerName + ""+", dateOrdered=" + dateOrdered + ", pizzaSize="+ pizzaSize + ", numberOfToppings="+ numberOfToppings+", toppingPrice=" + toppingPrice+"')";}} class Delivery extends PizzaOrder { private double tripRate; private int zone; public Delivery() { } public Delivery(String customerName, int pizzaSize, int numberOfToppings, double toppingPrice, double tripRate, int zone) { super(customerName, pizzaSize, numberOfToppings, toppingPrice); this.tripRate = tripRate; this.zone zone; } public double getTripRate() { return tripRate; } public void set TripRate(double tripRate) { this.tripRate = tripRate; }

Explanation:

Step 2 of 6

public int getZone() {return zone; } public void setZone (int zone) { this.zone zone; } @Override public double calculateOrderPrice() { return (super.calculateOrderPrice()+ (tripRate/100 super.calculateOrderPrice() zone)); } @Override public String toString() { return "Delivery(" + "customerName="" + super.getCustomerName() + ""+", tripRate="+tripRate+", zone=" + zone +

Explanation:

Step 3 of 6

class ToGo extends PizzaOrder

customerName, int pizzaSize, int numberOfToppings, double toppingPrice) (

public ToGo()() public ToGo(String super(customerName, pizzaSize, numberOfToppings, toppingPrice); } @Override public String toString() return "ToGo("+ "customerName="" + super.getCustomerName() +

class Seated extends PizzaOrder { private double serviceCharge; private int numberOfPeople; public Seated() {} public Seated(String customerName, int pizzaSize, int numberOfToppings, double toppingPrice, double serviceCharge, int numberOfPeople) { super(customerName, pizzaSize, numberOfToppings, toppingPrice); this.serviceCharge serviceCharge; this.numberOfPeople = numberOfPeople; } public double getServiceCharge() { return serviceCharge; } public void setServiceCharge(double serviceCharge) { this.serviceCharge = serviceCharge; } public int getNumberOfPeople() { return numberOfPeople; } public void setNumberOfPeople(int numberOfPeople) { this.numberOfPeople = numberOfPeople;) @Override public double calculateOrderPrice() { return (super.calculateOrderPrice()+ (serviceCharge numberOfPeople)); } @Override public String toString() (return "Seated(" + "customerName="+super.getCustomerName() + 1"+", serviceCharge="+ serviceCharge+", numberOfPeople" + numberOfPeople + ":)

class Driver (public static void main(String[] args) { ArrayList orders = new ArrayList(); orders.add(new Delivery("John". PizzaOrder.LARGE, 2, 3.5, 0.1, 1)); orders.add(new Delivery("Mike", PizzaOrder.MEDIUM, 3, 4.5, 0.2, 2)); orders.add(new ToGo("Jessica", PizzaOrder.SMALL, 1, 2.5)); orders.add(new Seated("Mary", PizzaOrder.LARGE, 3, 4.5, 0.1, 4)); orders.add(new Seated("Steven", PizzaOrder.MEDIUM, 2, 3.5, 0.2, 6)); sortOrders(orders); printSortedOrders(orders); System.out.println("Total sum of all order prices: " +calculateTotalOrders Price(orders)); System.out.println("Report for second Delivery order:" orders.get(1)); } Explanation:

Step 4 of 6

public static void sortOrders (ArrayList orders) { Collections.sort(orders); } public static void printSortedOrders (ArrayList orders) { for (PizzaOrder order: orders) (order.printOrderinfo(): }} public static double calculateTotal OrdersPrice(ArrayList orders) { double totalPrice = 0; for (PizzaOrder order: orders) { totalPrice += order.calculateOrderPrice(); } return totalPrice;}} Explanation:

Step 5 of 6

This program creates the five classes as specified, including the appropriate constructors, setter and getter methods, and methods for calculating the order price and printing order information. The Driver class includes a mae method that creates an ArrayList of zzaOrder objects, adds five different orders to it, sorts the orders based on their calculated order price, prints the sorted orders' customer names and prices, prints the total sum of all order prices, and prints a report for the second delivery order. Additionally, the Driver class

includes two helper methods: sortOrders and calca--

teTotalOrdersPrice, which are used in the mac method.

Explanation:

Step 5 of 6

This program creates the five classes as specified, including the appropriate constructors, setter and getter methods, and methods for calculating the order price and printing order information. The Driver class includes a mae method that creates an ArrayList of zzaOrder objects, adds five different orders to it, sorts the orders based on their calculated order price, prints the sorted orders' customer names and prices, prints the total sum of all order prices, and prints a report for the second delivery order. Additionally, the Driver class includes two helper methods: sortOrders and calca-- teTotalOrdersPrice, which are used in the mae method.

Explanation:

Step 6 of 6

It's worth noting that the Pizza Order class implements the Comparable interface and overrides the compareTo method. The compareTo method compares the prices of two PizzaOrder objects, allowing the Collections.sort method to sort the ArrayList of orders based on their prices. It's also worth noting that the toString method for Delivery, ToGo, and Seated classes are overridden, in order to display the specific properties of those classes. In the main method, the objects are created by passing the attributes in the order specified in the prompt, and the attributes are hardcoded, not taking the input from the user. Finally, the calculateOrder Price method in the Delivery and Seated classes override the one in the PizzaOrder class and adds the appropriate calculation to the price.

Write a complete Java program that creates the following classes: For this assignment, you will use the same classes you created in Project phase I 1- class PizzaOrder which implements the Comparable interface and contains the ( PizzaOrder, Delivery, ToGo, and Seated) and build a javafx GUI to provide input and following attributes and member methods: output as follows: - customerName ( String) Your Driver class should first build and display a GUl containing the following items: - dateOrdered (Date) - customerName ( String) - default empty - pizzaSize (final static int SMALL=1, MEDIUM=2, LARGE=3) - orderType (ToGo, Delivery, or Seated) - default ToGo - numberofToppings ( int) - pizzaSize (int 1 = SMALL, 2= MEDIUM, and 3 = LARGE) default 1 (SMALL) - toppingPrice (double) - List of Toppings ( at least three: Onions, Olives, and Green Peppers ) - - Appropriate constructors ( default and non default) as well as the default none appropriate setter and getter methods. - toppingPrice (double) - default (10) - A tostring() method. - orderPrice (double) - default (0.0) - Method calculateOrderPrice() which calculates the price of the pizza order as follows: You are free to design your interface, but you need to at least use ONE OF (numberOfToppings * toppingPrice) * pizzaSize EACH of the following ( you may use more that one of each if you like): - Method printOrderinfo () which prints only the customer's name and the - Label calculated order price on one line to the screen. - Button - CheckBox 2- class Delivery which extends PizzaOrder and contains the following attribute and - RadioButton methods: - ComboBox - tripRate (double) - TextField - zone ( int 1-4) - Appropriate constructors ( default and non default) as well as the appropriate setter and getter methods. The default GUI displayed should NOT have any Labels or Text fields for 0 toString0 method that overrides the method in PizzaOrder. (int). As soon as the user selects a pizza order of type Delivery, a tripRate - A calculateOrderPrice() method which overrides the method in PizzaOrder and adds the ( tripRate /100 totalprice * zone ) to the price. 3. class ToGo which extends PizzaOrder. 4. Class Seated which extends PizzaOrder and contains the following attribute and methods: - serviceCharge (double) - numberofPeople (int) o tostring() method that overrides the method in PizzaOrder. - A calculateOrderPrice() method which overrides the method in PizzaOrder appropriately and if he/she selects a pizza order of type Seated then the and adds the ( serviceCharge * numberOfPeople ) to the price. tripRate and zone Labels and Textfields should disappear and get replaced by a serviceCharge and numberOfPeople Labels and Textfields 5- A Driver class which includes the following methods: appropriately. When the user selects a ToGo pizza order then tripRate + - main method that does the following: zone OR serviceCharge + numberOfPeople labels and textfields should disappear from the GUI. creates an ArrayList called orders of type PizzaOrder and adds five different orders to it ( two Delivery, one ToGo, and two Seated). Your GUI should include three buttons at the bottom labeled ProcessOrder, You must NOT ask the user to enter the attributes but you PrintOrders, and Reset respectively. should fill them up directly in the main method. MAKE SURE YOUR CONSTRUCTORS FOLLOW THE SAME ORDER OF ATTRIBUTES AS SPECIFIED ABOVE AS FOLLOWS: After the user fills the form and presses the button ProcessOrder your program should do the following

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!