Question: [16 points) Write a class Customer which has the following private fields: - A String name - An int representing the balance in cents) of

 [16 points) Write a class Customer which has the following private

[16 points) Write a class Customer which has the following private fields: - A String name - An int representing the balance in cents) of the customer - A Basket containing the reservations the customer would like to make. The class must also have the following public methods: - A constructor that takes as input a String indicating the name of the customer, and an int representing their initial balance. The constructor uses its inputs and creates an empty Basket to initialize the corresponding fields. - A getName and a getBalance method which return the name and balance in cents) of the customer respectively. A get Basket method which returns the reference to the basket of the customer (no copy of the basket is needed). An addFunds method which takes an int as input reprezenting the amount of cents to be added to the balance of the customer. If the input received is negative, the method should throw an IllegalArgumentException with an appropriate message. Otherwise, the method will simply update the balance and return the new balance in cents

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!