Question: java program Write a class for modeling a customer. A customer knows its arrival time, its initial number of items, as well as the number

java program

java program Write a class for modeling a customer. A customer knows

Write a class for modeling a customer. A customer knows its arrival time, 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). Make sure you identified instance variables and 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: MAX_NUM_ITEMS * Math.random() + 1 Since, Math.random() generates a random number greater than or equal to 0.0 and less than 1.0, the expression MAX_NUM_ITEMS * Math.random() generates a number greater than or equals to 0.0 and less than MAX_NUM_ITEMS, adding 1 ensures that the number of items is greater than or equals to 1.0 but lower than MAX_NUM_ITEMS + 1. This real value is then converted to an int, in the range 1 to MAX_NUM_ITEMS (here, I wanted to 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!