Question: Customer Write a class for modeling a customer. A customer knows its arrival time ( represented by an int value ) , its initial number

Customer
Write a class for modeling a customer. A customer knows its arrival time (represented by an int value), its initial number of items, as well as the number of items remaining to be processed. The maximum number of items per customer is (MAX_NUM_ITEMS).
What are the instance variables?
What are the class variables?
The constructor has a single parameter. It specifies the arrival time. The initial number of items is determined when the object is first created using the following formula:
Random generator;
generator = new Random();
int numItems;
numItems = generator.nextInt(MAX_NUM_ITEMS-1)+1;
Here, we make sure that no customer would show up empty handed!
The instance methods of a customer include:
int getArrivalTime() returns the arrival time;
int getNumberOfItems() returns the number of items remaining to be processed;
int getNumberOfServedItems() returns the number of items that have been processed;
serve() decrements by one the number of items of this customer.

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!