public class CustomerArrival { int arrivalTime; int startServiceTime; int endServiceTime; int waitingTime; } CustomerArr

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

public class CustomerArrival { int arrivalTime; int startServiceTime; int endServiceTime; int waitingTime; } CustomerArr

Post by answerhappygod »

Public Class Customerarrival Int Arrivaltime Int Startservicetime Int Endservicetime Int Waitingtime Customerarr 1
Public Class Customerarrival Int Arrivaltime Int Startservicetime Int Endservicetime Int Waitingtime Customerarr 1 (24.8 KiB) Viewed 29 times
Public Class Customerarrival Int Arrivaltime Int Startservicetime Int Endservicetime Int Waitingtime Customerarr 2
Public Class Customerarrival Int Arrivaltime Int Startservicetime Int Endservicetime Int Waitingtime Customerarr 2 (69.75 KiB) Viewed 29 times
public class CustomerArrival { int arrivalTime; int startServiceTime; int endServiceTime; int waitingTime; } CustomerArrival (int aT){ this.arrivalTime=aT; this.startServiceTime=0; this.endServiceTime=0; this.waitingTime=0; ► CustomerArrival (){ } } } public int getArrivalTime () { return this.arrivalTime; this.arrivalTime=0; this.startServiceTime=0; this.endServiceTime=0; this.waitingTime=0; } public String toString() { return (this.arrivalTime + " " + this.startServiceTime+ " "+ this.endServiceTime+ + this.waitingTime) ;
SetB - Question2(2022) followed by the total and average waiting time. Sample Input-Output Input 2 7 8 24 25 28 0 Output 2#2#9#0 7#9#16#2 8#16#23#8 24#24#31#0 25#31#38#6 28#38#45#10 Total waiting time: 26 unit Average waiting time: 4.33 unit
SetB - Question2(2022) Proposed Algorithm 1. Define a CustomersArrival class that has four attributes; 2. 3. 28#38#45#10 Total waiting time: 26 unit Average waiting time: 4.33 unit arrival Time, startServiceTime, endServiceTime and waiting Time. Create a Queue of CustomerArrival. Based on standard input, for non-zero arrival time: Set the arrival Time Calculate the startServiceTime. o For the first customer, • startServiceTime = arrival Time. o For the others, • startServiceTime = endServiceTime of previous customer or his arrival Time, whichever the earliest. Calculate the endServiceTime: o endServiceTime = startServiceTime + task completion period Calculate the waiting Time: o waiting Time = startServiceTime - arrival Time 4. Calculate average waiting Time; all waiting times divide by the number of customers 5. Display all information based on the following format: <arrivalTime>#<startServiceTime>#<endServiceTime>#<waitingTime> 6. Display total and average waiting time + Grading Criteria
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply