Question: Java Assignment with 5 classes (Customer, Gold, Silver, Main, Billing) Cellphone companies offer various service plans to their customers, and customers are charged different fees

Java Assignment with 5 classes (Customer, Gold, Silver, Main, Billing)

Cellphone companies offer various service plans to their customers, and customers are charged different fees based on their plan. Your assignment is to create a program that allows a cellphone company to generate monthly bills for their customers. For this assignment we will assume that a cellphone service company offers the following service plans:

Bronze: $40 per month for 450 minutes and 45 for every additional minute.

Silver: $60 per month for 900 minutes and 40 for every additional minute.

Gold: $70 per month for unlimited minutes

The company also provides the following discounts:

Bronze: The customer receives no discounts.

Silver: The customer receives a 2% discount if they were a customer for more than 10 years.

Gold: The customer receives a 4% discount if they have been a customer for more than 10 years.

Your Tasks: Create the classes described by the UML diagram with all the methods and variables shown. You are allowed to add additional methods or variables.

1. Create Customer.java to represent a Bronze cellphone service customer.

Attributes

i. name: the customers full name

ii. accountNum: customers account number

iii. minutesUsed: total number of minutes used by customer this month

iv. baseCharge: the base monthly charge ($40, $60, $70)

v. minsLimit: the minutes the plan includes

vi. chargePerAdditionalMin: the charge per minute when minsLimit is exceeded

vii. discount: the percentage discount the customer receives

Methods:

i. constructor: initializes the customers name and account number to parameters

ii. toString(): return name, account number, monthly charge for the customer as a string

iii. setMinutesUsed(int min): set the minutesUsed to the parameter passed in

iv. getDiscount():returns the discount amount provided to this customer for the month

v. getCharges(): returns the monthly fee for this customer with discount included

vi. setDiscount(int numYears): sets the discount percent based on years

vii. getFullCharge(): returns the fee without the discount

2. Create 2 sub-classes of Customer.java: Silver.java, and Gold.java that does the following:

i. inherits the data values and methods from the Customer class.

ii. Both child classes will override the setDiscount(int numYears)

iii. Gold will also override the getFullCharge()

iv. Add additional data values and or methods as appropriate.

3. Create a driver class Billing.java which does the following:

Attributes:

i. Your choice

Methods:

i. constructor: takes the location of a file as a String

ii. Your choice of additional methods that does the following:

* Reads the file passed to the constructor. The file lists the name, account number, plan type, and number of minutes used for at most 100 customers. (See canvas for a sample file customer.txt). Put all customers into an array of type Customer[].

* Compute the monthly charge for each customer based on their service plan and minutes.

* Print to screen all the customers name, account number, monthly charges, and discount. The list should be sorted in ascending order based on the customers monthly charge. (This requires completing step 4). Call the Arrays.sort() method passing it the Customers array.

4. Make your Customer class implement the Comparable interface.

5. Make a Main.java class which has the main method and calls appropriate methods of Billing.

Here is an example of what customers.txt may contain. The columns are customer name, account number, plan type, minutes used, and number of years as a customer.

Java Assignment with 5 classes (Customer, Gold, Silver, Main, Billing) Cellphone companies

Here is what should be output to the screen . Note customers are sorted by their monthly charge. Also note that the discount amount is the discount*fullCharge value.

offer various service plans to their customers, and customers are charged different

Tint Tequne 0ompleting step 4). Call the Arrays.sort) method passing it the monly charge Customers array. 4. 5. Make your Customer class implement the Comparable interface Make a Main.java class which has the main method and calls appropriate methods of Billing Here is an example of what customers.txt may contain. The columns are cust number, plan type, minutes used, and number of years as a customer. omer name, account Fred Mertz Bob Dobb S.B. SquarePants 33333 Draco Falmov Samantha Jones 67890 Gold Silver Gold Bronze Bronze Bronze Silver Gold 1012 737 912 491 4 68 397 1292 1631 12 12345 15 Ethel Mertz Jim Hawkins 12121 21 NIote customers are sorted by their monthly charge Tint Tequne 0ompleting step 4). Call the Arrays.sort) method passing it the monly charge Customers array. 4. 5. Make your Customer class implement the Comparable interface Make a Main.java class which has the main method and calls appropriate methods of Billing Here is an example of what customers.txt may contain. The columns are cust number, plan type, minutes used, and number of years as a customer. omer name, account Fred Mertz Bob Dobb S.B. SquarePants 33333 Draco Falmov Samantha Jones 67890 Gold Silver Gold Bronze Bronze Bronze Silver Gold 1012 737 912 491 4 68 397 1292 1631 12 12345 15 Ethel Mertz Jim Hawkins 12121 21 NIote customers are sorted by their monthly charge

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!