Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What Is Psychology?

Answered: 1 week ago

Question

socialist egalitarianism which resulted in wage levelling;

Answered: 1 week ago

Question

soyuznye (all-Union, controlling enterprises directly from Moscow);

Answered: 1 week ago