Question
Program Assignment #1 Instructions Write a program that simulates customers waiting in line at a grocery store. Your program must use a Queue to represent
Program Assignment #1 Instructions Write a program that simulates customers waiting in line at a grocery store. Your program must use a Queue to represent the customer objects waiting in line. A Customer class is provided for you (download from Canvas). You must use that class, without alternations, for the creation of your Customer objects. You must analyze the class and use the provided methods to achieve the desired functionality of the program. You will also need to create two additional classes. The first will be a Linked List Queue that will represent the data structure for holding your Customer objects. The second is a driver where your store simulation will take place. The program (driver) should simulate 60 minutes of activity at the store. Each iteration of your program should represent one minute. At each iteration (minute), your program should do the following: Check to see if new customers are added to the queue. There is a 25% chance that new customers show up (need to be added to the queue) every minute. This does not mean you should add a customer every four iterations, but rather each iteration should have its own 25% chance. Update the customer object currently being serviced (if one exists). This will be the customer object at the front of the queue. If the customer has been completely serviced, remove them from the queue. During execution, your program should output the following information: When a new customer is added to the queue, output, New customer added! Queue length is now X where X is the size of the queue after the new customer has been added. When a customer has been completely serviced, output, Customer serviced and removed from the queue. Queue length is now X where X is the size of the queue after the customer has been removed. At the end of each iteration (minute), output, --------------------------------------------------- to visually identify the passing of time. When your simulation ends, your program should also output the following information: Total number of customers serviced Maximum line length during the simulation To submit your program, zip only your Driver and Queue classes together and upload them Canvas (not the whole project). Make sure youre submitting the .JAVA file and not the .CLASS file. Your program will be executed using the Customer class provided on Canvas. The rubric below will be used in the grading of your program. Partial points may be awarded for each category. Category Value Program is free of errors and is well-commented / 5 Successfully implement your own Linked Queue (not Javas) that holds Customer objects / 25 Program structure successfully simulates a 60 minute time period using 1 iteration = 1 minute / 10 New Customer are successfully created and added to the queue 25% of the time (each minute) / 10 Program uses the provided Customer class without alterations to create Customer objects / 15 The customer at the front of the queue is successfully serviced and removed from the queue / 20 The program displays the correct output during the simulation / 10 The program displays the correct output at the end of the simulation / 5 Total Points / 100
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