Programming Question
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →HW 02-1 Paper Route We want to represent a collection of Customer for a local newspaper delivery agent. The newspaper is published and delivered by subscription “daily” Mondays through Saturdays, and there is also a “Sunday” subscription sold separately. Here is a summary of class Customer: Customer String String String boolean boolean double name streetAddress city hasDaily //gets delivery weekdays Mon–Sat hasSunday //gets delivery of Sunday amountDue //current balance —————————————-Customer(………….) //fields for all inst. vars Getters and setters toString() The current balance is updated at the end of the week [Sunday] to charge for the next week’s deliveries. The news agent can collect directly from the customer, or receive payment in a mailer envelope, or receive payment online. When a payment is received, the amount paid is deducted from amountDue. [Note: this assignment doesn’t call for any code to facilitate updating the data for payments collected.] ➔Easiest to create class Customer using same techniques we used for Bill at session 1B: SOURCE tab, then add constructor using fields, add getters, add toString()…. 1. Code class PaperRoute to encapsulate a collection of ➔ Required: Implement the collection using an ArrayList Methods of PaperRoute: • Constructor with no arguments [must initialize the private instance variable for a Collection] • void addCustomer( various fields with data as parameters ) • double totDue() //totals all amounts due from all customers — returns value • void displayAll() //output list of info for each Customer [could use toString()] ➔implement using a for-each loop int countBySubscriptionType(String kind) //kind is ”daily” or “Sunday” or “both” • // returns count ➔implement using a for-each loop ➔Add class Tester with a main() method to your project that will: • • • • Non-Interactive test application… Instantiate a new PaperRoute object myCusts “Hardwire” your add at least four Customers with good test data to myCusts code for repeatable display the total amount due from all Customers in myCusts test…. display the count of Customers of a given type: e.g., how many in the collection subscribe to both daily and Sunday? Deliverable: Attach zip of Eclipse project, plus a screen shot of output from a trial run (jpg, png or in a Word doc). Insert a javadoc at start of Tester acknowledging whether work is completely original or if and help was received. In the submit textbox, be sure and note any known omissions or defects. OOPDA HW 02-1 PaperRoute v2b SP24 1/21/2024 7:24:00 AM
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds