Question: The Problem (JAVA) It is summer time, and the heat is scorching! To beat the heat, many FCIT students decided to start a car cleaning
The Problem (JAVA) It is summer time, and the heat is scorching! To beat the heat, many FCIT students decided to start a car cleaning business called FCIT CarClean. So while at the College, you can now have your car washed, waxed, and even vacuumed. The student workers will get wet, have fun, and even make some money! Services include: Washing (10sr) Waxing (10sr) Vacuuming (5sr) Important Rules: 1.Assume that only a single car gets serviced at a time, and that each car takes the same amount of time to get serviced based on their level of service as described above (the time for each service, for one car, is given in the input file). 2.The unit of time is taken to be one minute. Any fractions of a minute are being ignored. 3.If an arrival and departure occur during the same minute, the departure is processed first. 4.If a car arrives when the queue is empty and no cars are being washed, the car starts getting washed immediately; it is not put on the queue. 5.As soon as it leaves the queue and enters the wash station, the waiting time for the car is over. 6.If a car arrives in the same minute interval a car wash is over, but there is no place to wait, then the next waiting car immediately moves into the station, and the arriving car joins the other waiting cars. 7.FCIT car wash opens at 10 AM and entry to the premises closes at 4 PM. The arrival time indicated on the input file would be in minutes starting at 10 AM. The amount of time required to wash, wax, and vacuum the car is dependent on the 8.The amount of time required to wash, wax, and vacuum the car is dependent on the student workers (maybe some students will work harder than others). Therefore, the wash time, wax time, and vacuum time will be given on the input data file and should be used as constants for that specific days simulation. 9.It is guaranteed that the arrival times will be in a non-decreasing sequence. Cars which enter the College before 4 PM and find a place in the waiting queue will get washed. 10.Voucher Code Z is reserved for Mr. Nabeel. Whenever you see this code, this means that this line is not a customer; rather, it is Mr. Nabeel arriving to empty the stack of vouchers. The corresponding time of arrival will indicate the time Mr. Nabeel arrives to pick up the vouchers. *Note: Mr. Nabeel does not have to wait in the queue and therefore does not take up space. 11.Mr Nabeel also automatically comes at the end of every day (once the last customer has left FCIT Car Clean).
Service Waiting Line As mentioned, as soon as a customer enters FCIT Car Clean, they must wait in the service waiting queue. You can implement this line as a linked-list based queue or as an array-based queue. Stacks of Vouchers: When a student starts the actual service, they must place their voucher into a box, which stores the vouches in the form of a stack. Then, whenever Mr Nabeel comes, he collects the stack of vouchers and records the data (which means an output will print!). Also, Mr Nabeel comes at the end of each day to also collect any remaining vouchers. Therefore, at the beginning of the next day, the voucher stack will be empty. You can implement this line as a linked-list based stack or as an array-based stack. Notes: The first line of the file will contain an integer representing the maximum size of the waiting queue of cars. The second line will contain an integer representing the number of days for the simulation. For each day of the simulation, the first line will contain 3 integers indicating the time for one car-wash, the time for one car-wax, and the time for one vacuum. The second line will be an integer k, representing the number of customers coming on that Day. Next will be k lines of data, where each line represents one customer. Each line will have five pieces of data: an integer, indicating the time, in number of minutes after 10AM, of the arrival of a car; an integer ID, which is the student/employee ID; a String for the first name of the customer; a String for the second name of the customer; and a String, representing the voucher code (W, WW, or WWV) received from Mr. Nabeel. Input File: 5 2 10 8 5 12 15 1117771 Abdurrahman Altalhi WWV 20 1117772 Iyad Katib WWV 40 1117773 Aiiad Albishri WWV 55 1117774 Jonathan Cazalas W 359 1111111 First1 Last1 WWV 359 1111112 First2 Last2 WWV 359 1111113 First3 Last3 WWV 359 1111114 First4 Last4 WWV 359 1111115 First5 Last5 WWV 359 1111116 First6 Last6 WWV 359 1111117 First7 Last7 WWV 360 1111118 First8 Last8 WWV 8 6 4 14 5 1112389 Rayyan Alharthi W 5 1112395 Bilal Damanhouri W 7 1113215 Yazeed Jamaan W 12 1112195 Khalid Barnawi WWV 12 1119851 Elyas Zubaidi W 13 1116428 Abdulmajeed Zahrani W 14 1117515 Ali Alghamdi W 18 1116812 Hammaam Ashihiri W 20 1113786 Muhammad Alhaamdi W 25 1114182 Fahad Alaydarous W 32 1117770 Mr Nabeel Z 50 1118987 Ibraheem Jahlaan W 100 1113193 Wajdi Alasmari W 120 1114084 Saalih Subhee WW Output Welcome to the FCIT Car Clean Simulator ********** Day 1: ********** 10:15 PM: Abdurrahman Altalhi arrived at the FCIT Car Clean and immediately started Class WWV service. 10:20 PM: Iyad Katib arrived at the FCIT Car Clean and entered Wash Queue. 10:38 PM: The car for Abdurrahman Altalhi is now finished. Waiting time in line: 0 minutes Service time: 23 minutes Total time: 23 minutes 10:38 PM: Iyad Katib has now started Class WWV service. 10:40 PM: Aiiad Albishri arrived at the FCIT Car Clean and entered Wash Queue. 10:55 PM: Jonathan Cazalas arrived at the FCIT Car Clean and entered Wash Queue. 11:01 PM: The car for Iyad Katib is now finished. Waiting time in line: 18 minutes Service time: 23 minutes Total time: 41 minutes 11:01 PM: Aiiad Albishri has now started Class WWV service. 11:24 PM: The car for Aiiad Albishri is now finished. Waiting time in line: 21 minutes Service time: 23 minutes Total time: 44 minutes 11:24 PM: Jonathan Cazalas has now started Class W service. 11:34 PM: The car for Jonathan Cazalas is now finished. Waiting time in line: 29 minutes Service time: 10 minutes Total time: 39 minutes 3:59 PM: First1 Last1 arrived at the FCIT Car Clean and immediately started Class WWV service. 3:59 PM: First2 Last2 arrived at the FCIT Car Clean and entered Wash Queue. 3:59 PM: First3 Last3 arrived at the FCIT Car Clean and entered Wash Queue. 3:59 PM: First4 Last4 arrived at the FCIT Car Clean and entered Wash Queue. 3:59 PM: First5 Last5 arrived at the FCIT Car Clean and entered Wash Queue. 3:59 PM: First6 Last6 arrived at the FCIT Car Clean and entered Wash Queue. 3:59 PM: First7 Last7 arrived at the FCIT Car Clean. Unfortunately, the Wash Queue is full, and the customer left disappointed. 4:00 PM: First8 Last8 arrived at the FCIT Car Clean. However, the car wash is CLOSED. 4:22 PM: The car for First1 Last1 is now finished. Waiting time in line: 0 minutes Service time: 23 minutes Total time: 23 minutes 4:22 PM: First2 Last2 has now started Class WWV service. 4:45 PM: The car for First2 Last2 is now finished. Waiting time in line: 23 minutes Service time: 23 minutes Total time: 46 minutes 4:45 PM: First3 Last3 has now started Class WWV service. 5:08 PM: The car for First3 Last3 is now finished. Waiting time in line: 46 minutes Service time: 23 minutes Total time: 69 minutes 5:08 PM: First4 Last4 has now started Class WWV service. 5:31 PM: The car for First4 Last4 is now finished. Waiting time in line: 69 minutes Service time: 23 minutes Total time: 92 minutes 5:31 PM: First5 Last5 has now started Class WWV service. 5:54 PM: The car for First5 Last5 is now finished. Waiting time in line: 92 minutes Service time: 23 minutes Total time: 115 minutes 5:54 PM: First6 Last6 has now started Class WWV service. 6:17 PM: The car for First6 Last6 is now finished. Waiting time in line: 115 minutes Service time: 23 minutes Total time: 138 minutes 6:18 PM: Mr Nabeel came and collected the following vouchers: First6 Last6(1111116) First5 Last5(1111115) First4 Last4(1111114) First3 Last3(1111113) First2 Last2(1111112) First1 Last1(1111111) Jonathan Cazalas(1117774) Aiiad Albishri(1117773) Iyad Katib(1117772) Abdurrahman Altalhi(1117771) ********** Day 2: ********** 10:05 PM: Rayyan Alharthi arrived at the FCIT Car Clean and immediately started Class W service. 10:05 PM: Bilal Damanhouri arrived at the FCIT Car Clean and entered Wash Queue. 10:07 PM: Yazeed Jamaan arrived at the FCIT Car Clean and entered Wash Queue. 10:12 PM: Khalid Barnawi arrived at the FCIT Car Clean and entered Wash Queue. 10:12 PM: Elyas Zubaidi arrived at the FCIT Car Clean and entered Wash Queue. 10:13 PM: The car for Rayyan Alharthi is now finished. Waiting time in line: 0 minutes Service time: 8 minutes Total time: 8 minutes 10:13 PM: Bilal Damanhouri has now started Class W service. 10:13 PM: Abdulmajeed Zahrani arrived at the FCIT Car Clean and entered Wash Queue. 10:14 PM: Ali Alghamdi arrived at the FCIT Car Clean and entered Wash Queue. 10:18 PM: Hammaam Ashihiri arrived at the FCIT Car Clean. Unfortunately, the Wash Queue is full, and the customer left disappointed. 10:20 PM: Muhammad Alhaamdi arrived at the FCIT Car Clean. Unfortunately, the Wash Queue is full, and the customer left disappointed. 10:21 PM: The car for Bilal Damanhouri is now finished. Waiting time in line: 8 minutes Service time: 8 minutes Total time: 16 minutes 10:21 PM: Yazeed Jamaan has now started Class W service. 10:25 PM: Fahad Alaydarous arrived at the FCIT Car Clean and entered Wash Queue. 10:29 PM: The car for Yazeed Jamaan is now finished. Waiting time in line: 14 minutes Service time: 8 minutes Total time: 22 minutes 10:29 PM: Khalid Barnawi has now started Class WWV service. 10:32 PM: Mr Nabeel came and collected the following vouchers: Khalid Barnawi(1112195) Yazeed Jamaan(1113215) Bilal Damanhouri(1112395) Rayyan Alharthi(1112389) 10:47 PM: The car for Khalid Barnawi is now finished. Waiting time in line: 17 minutes Service time: 18 minutes Total time: 35 minutes 10:47 PM: Elyas Zubaidi has now started Class W service. 10:50 PM: Ibraheem Jahlaan arrived at the FCIT Car Clean and entered Wash Queue. 10:55 PM: The car for Elyas Zubaidi is now finished. Waiting time in line: 35 minutes Service time: 8 minutes Total time: 43 minutes 10:55 PM: Abdulmajeed Zahrani has now started Class W service. 11:03 PM: The car for Abdulmajeed Zahrani is now finished. Waiting time in line: 42 minutes Service time: 8 minutes Total time: 50 minutes 11:03 PM: Ali Alghamdi has now started Class W service. 11:11 PM: The car for Ali Alghamdi is now finished. Waiting time in line: 49 minutes Service time: 8 minutes Total time: 57 minutes 11:11 PM: Fahad Alaydarous has now started Class W service. 11:19 PM: The car for Fahad Alaydarous is now finished. Waiting time in line: 46 minutes Service time: 8 minutes Total time: 54 minutes 11:19 PM: Ibraheem Jahlaan has now started Class W service. 11:27 PM: The car for Ibraheem Jahlaan is now finished. Waiting time in line: 29 minutes Service time: 8 minutes Total time: 37 minutes 11:40 PM: Wajdi Alasmari arrived at the FCIT Car Clean and immediately started Class W service. 11:48 PM: The car for Wajdi Alasmari is now finished. Waiting time in line: 0 minutes Service time: 8 minutes Total time: 8 minutes 12:00 PM: Saalih Subhee arrived at the FCIT Car Clean and immediately started Class WW service. 12:14 PM: The car for Saalih Subhee is now finished. Waiting time in line: 0 minutes Service time: 14 minutes Total time: 14 minutes 4:00 PM: Mr Nabeel came and collected the following vouchers: Saalih Subhee(1114084) Wajdi Alasmari(1113193) Ibraheem Jahlaan(1118987) Fahad Alaydarous(1114182) Ali Alghamdi(1117515) Abdulmajeed Zahrani(1116428) Elyas Zubaidi(1119851)
FCITmember Data Members FCITvoucher Data Members private int arrivalTime; private int timeStarted; private int ID; private String firstName; private String lastName; private String code; private int minutesRemaining; private FCITmember next; private int arrivalTime; private int ID; private String firstName; private String lastName; private String code; private int timeStarted; private int timeFinished; private FCITvoucher next; Operations/Methods Operations/Methods CONSTRUCTOR (one or more constructors as needed) ALL obvious getter/setter methods CONSTRUCTOR (one or more constructors as needed) ALL obvious getter/setter methods As you can see, I chose to use linked-list based Queues and Stacks, which is why you see the "next" member variable As you can see, I chose to use linked-list based Queues and Stacks, which is why you see the "next" member variable FCITcarClean Data Members FCITvouchers Data Members private FCITmember front; private FCITmember back; private int numCustomers; private FCITvoucher top; Operations/Methods CONSTRUCTOR (one or more constructors as needed) ALL obvious Queue methods And any other methods you may need or want Operations/Methods CONSTRUCTOR (one or more constructors as needed) ALL obvious Queue methods And any other methods you may need or want FCITmember Data Members FCITvoucher Data Members private int arrivalTime; private int timeStarted; private int ID; private String firstName; private String lastName; private String code; private int minutesRemaining; private FCITmember next; private int arrivalTime; private int ID; private String firstName; private String lastName; private String code; private int timeStarted; private int timeFinished; private FCITvoucher next; Operations/Methods Operations/Methods CONSTRUCTOR (one or more constructors as needed) ALL obvious getter/setter methods CONSTRUCTOR (one or more constructors as needed) ALL obvious getter/setter methods As you can see, I chose to use linked-list based Queues and Stacks, which is why you see the "next" member variable As you can see, I chose to use linked-list based Queues and Stacks, which is why you see the "next" member variable FCITcarClean Data Members FCITvouchers Data Members private FCITmember front; private FCITmember back; private int numCustomers; private FCITvoucher top; Operations/Methods CONSTRUCTOR (one or more constructors as needed) ALL obvious Queue methods And any other methods you may need or want Operations/Methods CONSTRUCTOR (one or more constructors as needed) ALL obvious Queue methods And any other methods you may need or want
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
