Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program will simulate the management of DoorDash deliveries for a delivery person dasher for a day. We will keep track of information for

imageimageimage

This program will simulate the management of DoorDash deliveries for a delivery person "dasher" for a day. We will keep track of information for customers, dashers, and orders as described below. The program will keep track of a dasher's average rating and percent on time. Part 1 - Setting up the classes and interface We will create the following classes: Person, Customer, Dasher, and Order, as described below. Since customers and dashers both have personal information, including name, email, and phone, we will create a class called Person which they can both extend. Customer Person Dasher The Person class will include attributes for: name, email, and phone. Include a constructor, set, and get methods. The Customer class will extend the Person class and include an attribute for delivery address. Create a constructor, set, and get method. The Order class will include the following information: Customer, restaurant name, number of items, and order price. Create the necessary constructor and set / get methods. The Dasher class will also extend the Person and include the following attributes: ArrayList of Order type called orders, vehicle type (could be bike or car), total rating, and total on time deliveries. In addition to the constructor and set / get method, we will also need the following methods: addRating(int rating) - adds rating to the total rating (a rating can be from 1 to 5) onTime (boolean wasOnTime) - adds 1 to the total on time deliveries if that order was on time averageRating() - compute and return the average rating for the dasher (use size of orders list to know the number of deliveries) Note: remember to avoid integer division percentOnTime() - compute and return the percent the dasher was on time (use size of orders list to know the number of deliveries) Note: remember to avoid integer division, as above percentOnTime() - compute and return the percent the dasher was on time (use size of orders list to know the number of deliveries) Note: remember to avoid integer division, as above addOrder(Order order) - add Order to orders ArrayList Define an interface called Printable that contains a method called printInfo() as shown below (In Eclipse, when adding the file, select interface instead of class): public interface Printable { public void printInfo(); } Have the Customer, Dasher, and Order classes implement this interface. The printInfo() method will display the information in that class. A class can both extend a class and implement an interface as in: public class Customer extends Person implements Printable{ } Note: We can use the super keyword in the subclass constructors and printInfo() methods of the subclasses. Part 2- Implementing a main method Make a class called Main that contains a main method in which we will: Create a Dasher object that we will use to store the orders for a day. The flow of the program will be: Enter information for the Dasher 56 Part 2 - Implementing a main method Make a class called Main that contains a main method in which we will: Create a Dasher object that we will use to store the orders for a day. The flow of the program will be: Enter information for the Dasher Create a loop to enter orders for the day (use a while loop) o The user will enter the information for each order including: Customer information Rest of order information Ask for the customer rating Ask if the dasher was on time When the orders are all entered, loop through the orders to save all information related to the orders in a file called "orders.txt" (Can either be done in the printinfo() method of the Dasher class or in main using a getOrders() method of Dasher that would return the orders ArrayList). Display on the screen the summary for the dasher including their name, email, phone, vehicle type, average rating, and percent on time (in the printinfo() method). [Optional if you display the orders to the screen as well.] Part 3 - Adding information Customize your program by including 3 additional attributes you think would be important to include in this program (in any of the classes). Update the program to include this new information as needed.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Printablejava public interface Printable public void printInfo OrderJava public class Order implements Printable private Customer customer private String restaurantName private int noOfItems private f... 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

Data Analysis And Decision Making

Authors: Christian Albright, Wayne Winston, Christopher Zappe

4th Edition

538476125, 978-0538476126

More Books

Students also viewed these Programming questions