I need the program with output and send the source file (.java file) and the compiled file
Question:
I need the program with output and send the source file (.java file) and the compiled file (.class file) and please address all the questions.
Problem
Define classes: Salesperson, Wholesaler, Retailer, Company, and Invoice. You are going to make an application for a company to manage the sales for its salespeople: wholesalers and retailers.
A possible program design:
Make Salesperson the superclass, Wholesaler and Retailer the subclasses, and Company the driver class.
Note: You should consider having a main() in each class for testing the methods in each class independently to make sure each class works as intended before using in other classes.
1. Salesperson class has id, total sales, commission rate, an array/ArrayList of Invoice. Define a constructor that requires id and commission rate as argument and sets them to be the values of respective instance variables, Invoice() to add to the array/ArrayList of Invoice, calCommission() that returns the commission based on the total sales and commission rate, and a method to show all the invoices.
2. Wholesaler class has minimum sales per transaction. Define a constructor that sets the minimum sales per transaction and commission rate using the values of the input parameters and override do Invoice() to check the sales meeting the minimum sales per transaction and display error message otherwise. Override toString() to return a well- formatted string for all the wholesaler information including the commission received.
3. Retailer class has rent. Define a constructor that sets the rent using the value of the input parameter. Override calCommision() to deduct rent from gross commission and toString() to return a well-formatted string for all the retailer information including the commission received.
4. Invoice class has invoice number, sales for the transaction, and payment method [Cash, Check, Credit Card]. Override toString() to return a well-formatted string for invoice information.
5. Company class is the driver of the program. It has an ArrayList of Wholesaler and an ArrayList of Retailer.
OTHER REQUIREMENTS:
a. You may use one or more array(s) or ArrayList(s) to store objects of the Wholesaler and Retailer class. If you use two, then one should be for wholesalers and the other for retailers. (Hint: you should make this a private instance variable, similar to that in
the Bank class in Assignment 4)
b. For the commission rates, use 2% for wholesalers and 3.5% for retailers. (Hint:
consider making these constants in respective classes)
c. Wholesaler's minimum sales volume and Retailer's rent should be either from user
input or as constants.
d. Define a method initCompany() that requires either
• If you use only one array/ArrayList, an integer n to initialize either n Salesperson
objects with id starting from 1001 and incremented by 1.
i. Wholesalers have odd id and each wholesaler has 3 Invoices with unique
invoice numbers for sales equals to the id/invoice number multiplied by
3.
ii. Retailers have even id and each retailer has 5 Invoices with unique
invoice numbers for sales equals to the id/invoice number multiplied by
2.
iii. The total sales for each salesperson should be updated every time an
invoice is created,
OR
• If you use two arrays/ArrayLists, two integers to initialize the no of Wholesaler
and Retailer in respective array/ArrayList.
i. Wholesalers will have id from 1001, incremented by 1. Each wholesaler
has 3 Invoices with unique invoice numbers for sales equals to the
id/invoice number multiplied by 3.
ii. Retailers will have id from 501, incremented by 1. Each retailer has 5
Invoices with unique invoice numbers for sales equals to the id/invoice
number multiplied by 2.
iii. The total sales for each should be updated every time an invoice is
created.
e. The program should allow users to perform the following operations until the user
wants to quit:
• Add a wholesaler/retailer
• Add an invoice for a specific wholesaler/retailer
• Find a wholesaler/retailer by id
• Display all the wholesalers/retailers with total sales exceeding a certain value
• Remove a wholesaler/retailer by id
You need to decide what information to get from the user. You may add other methods needed for your program to perform the tasks. You may also move specified methods to another class if you deem better/necessary.
As for every program, it is important to display clear and meaningful instructions for users to enter needed information. Similarly, all displays should be well formatted and clear, e.g., the monetary values with only two digits after the decimal point
Accounting Information Systems
ISBN: 9780132871938
11th Edition
Authors: George H. Bodnar, William S. Hopwood