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...
-
If the guidelines for fiscal policy (Table 12.2) are so simple, why does the economy ever suffer from unemployment or inflation?
-
The diagram shows the curve meeting the x-axis at A and the y-axis at B. The y-coordinate of the point C on the curve is 3. i. Find the coordinates of B and C. ii. Find the equation of the normal to...
-
Match the measures of worth in the first column with one (or more) of the analysis approaches that is (are) appropriate for that measure. Measure of Worth (a) Annual Worth (b) External Rate of Return...
-
Louisville Sports manufactures baseball bats for use by players in the major leagues. A critical requirement for elite players is that each bat they use have an identical look and feel. As a result,...
-
What sql commands are used in RDBMS? What are the 5 basic SQL queries?
-
Toledo Clinic has two patient services departments: Adult Services and Pediatric Services The patient services departments are supported by General Administration, Facilities, and Financial Services....
-
An air-filled ion chamber is operated at a pressure of 4.3 atm and a temperature of 32C. If its active volume is 3200 cm 3 , find the saturated ion current corresponding to a gamma-ray exposure rate...
-
Unpolarized light is incident on a system of three ideal polarizers. The second polarizer is oriented at an angle of 45.0 with respect to the first, and the third is oriented at an angle of 55.0 with...
-
Piece of land and residential house (family home) P1,600,000 Agricultural land inherited from her father three and one-half years ago 420,000 Various real and personal properties 1,180,000...
-
Given the following information: Current Market Interest Rate: 6.5% Annual Number of Payments: 2 per Year X 3 years Annual Coupon Payment: $70 Present Value: -1030 find future value using excel.
-
Explain Income tax and its principle? How much is the income tax due in 2019 and 2021,? ZBD Corporation shows the following summary: 2018 2019 2020 2021 RCIT 100,000 150,000 Zero 25,000 MCIT 150,000...
-
Petra received expenses dated the 31st of the month but waited to record them until the next month to help the current month make the income goal. What type of financial statements fraud is Petra...
-
The Particle Accelerator LHC (Large Hadron Collider) at the International Particle Physics Research Organization CERN in Switzerland uses superconducting magnets to carry protons in a circular orbit...
-
Juanita owns a home in Richardson, TX. She purchases a Homeowners Policy (HO-3) from Farm State Ins. Co. The policy provides $100,000 in liability coverage (coverage E) and $5,000 in Med Pay coverage...
-
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...
-
Use a web platform such as Wordpress to create a portfolio that highlights your professional and academic accomplishments. Include course projects, workplace samples, and other documents that support...
-
Working individually, in pairs, or in small groups, as your instructor directs, a. Look at five of the example student rsums on VisualCV. com. What features do you like? Why? What features would you...
-
All of the following are first paragraphs in prospecting letters written by new college graduates. Evaluate the paragraphs on these criteria: Is the paragraph likely to interest readers and motivate...
Study smarter with the SolutionInn App