Answered step by step
Verified Expert Solution
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 MAXNUMITEMS
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.nextIntMAXNUMITEMS;
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started