This program will simulate the management of DoorDash deliveries for a delivery person dasher for a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Printablejava public interface Printable public void printInfo OrderJava public class Order implements Printable private Customer customer private String restaurantName private int noOfItems private f... View the full answer
Related Book For
Data Analysis and Decision Making
ISBN: 978-0538476126
4th edition
Authors: Christian Albright, Wayne Winston, Christopher Zappe
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Aria Perfume, Inc.. sold 3,210 boxes of white musk soap during January of 2016 at the price of $90 per box. The company offers a full refund for any product returned within 30 days from the date of...
-
Linda Shriber is a realtor. Shriber organized her business as a corporation on November 14, 2009. The business received $50,000 from Shriber and issued common stock. Consider these facts as of...
-
In Exercises find an equation of the tangent line to the graph of the function at the given point. y = xex - ex, (1, 0)
-
For each of the following residual plots, determine whether the assumptions of the linear model are satisfied. If they are not, specify which assumptions are violated. b. C. d.
-
(1) Why is the T-bills return independent of the state of the economy? Do T-bills promise a completely risk-free return? (2) Why are Alta Industries returns expected to move with the economy whereas...
-
Describe the (1) background information, (2) technical specifications, (3) processes involved, and (4) challenges that was encountered during operation or construction of the the world's largest...
-
Killer Whale, Inc. has the following balance sheet statement items: total current liabilities of $681,770; net fixed and other assets of $1,284,265; total assets of $3,395,673; and long-term debt of...
-
Introduction: Top Secret, Inc. (TSI) faces significant business-related challenges stemming from the use of a single-purpose operating system (TSI OS) for its back-office functions. This decision,...
-
Suppose you, as a college student, could choose between completing either a math assignment or a microeconomics assignment. Assume that you could complete the math assignment in 30 minutes, but...
-
1. How can you use current and emerging sector developments and/or research to improve practice? Describe an example that demonstrates this, 2. Suggest two occasions when specialist advice or the...
-
Calculate the amount of cash collections you will collect in November if you estimate you will collect 60% of your sales in the month of the sale, 25% the following month, 10% two months later and...
-
Describe the five characteristics of life, and list severalnonliving things that possess at least two of thesecharacteristics. Explain how an atom relates to the biosphere by describing thelevels of...
-
A RA KB 2000 lb 3 ft M = 4800 lb-ft BYMATHalino.c 6 ft 3 ft D Ro Write the shear and moment equations for the beam shown Draw the shear and moment diagrams, specifying values at all changes of...
-
The following items were displayed in the statement of affairs for Lubbock Company: Fully secured liabilities ......... $90,000 Partially secured liabilities ....... 12,000 Unsecured liabilities...
-
Suppose you believe that the price of a particular stock goes up each day with probability p and goes down with probability 1 - p. You also believe the daily price changes are independent of one...
-
Continuing Problems 6 and 15 on the 20062007 movie data in the file P02_02.xlsx, create a new variable Total Revenue that is the sum of Total US Gross, International Gross, and US DVD Sales. How well...
-
The stocks in the portfolio optimization model are all positively correlated. What happens when they are negatively correlated? Answer for each of the following scenarios. In each case, two of the...
-
For an ideal solution, isotherm on an enthalpy-concentration diagram will be (a) Parabola (b) Hyperbola (c) Sine curve (d) Straight line
-
For a reversible process, change in entropy of the system (a) Approaches to zero (b) Increases (c) Decreases (d) Remains constant
-
For a multi-component system, the chemical potential is equivalent to (a) Molar free energy (b) Molar concentration difference (c) Molar free energy change (d) Partial molar free energy
Study smarter with the SolutionInn App