Question: Consider the Queue data structure implementation to implement a market waiting line. You need to implement the following classes: 1) class Customer that includes the

 Consider the Queue data structure implementation to implement a market waitingline. You need to implement the following classes: 1) class Customer thatincludes the following data members: private String name; //Customer name private intorder ID; l/order id private int totalItems; //total Items private Customer next;

Consider the Queue data structure implementation to implement a market waiting line. You need to implement the following classes: 1) class Customer that includes the following data members: private String name; //Customer name private int order ID; l/order id private int totalItems; //total Items private Customer next; The class should have the following: A constructor that initializes the instance variables name, totalltems and . orderlD. Set and get methods for each instance variable. Enter the total items: 4 Choose: 1. Add a Customer 2. Print all Customers 3. Find queue size 4. minimum items 5. Find average 6. Exit 2 1- Customer name: Fatma , Order Number: 1, Total Items: 5 2- Customer name: Ali, Order Number: 2, Total Items: 10 3- Customer name: Sara , Order Number: 3, Total Items: 4 Choose: 1. Add a Customer 2. Print all Customers 3. Find queue size 4. minimum items 5. Find average 6. Exit 3 Enter the customer name: Sara Waiting line size is 3 output Choose: 1. Add a Customer 2. Print all Customers 3. Find queue size 4. minimum items 5. Find average 6. Exit 4 Minimum items are 4 items Choose: 1. Add a Customer 2. Print all Customers 3. Find queue size 4. minimum items 5. Find average 6. Exit 5 Average items is 6.333 items Choose: 1. Add a Customer 2. Print all Customers 3. Find queue size 4. minimum items 5. Find average 6. Exit 6 Bye! 2) class Waiting Line that includes the following instance variables: private Customer head, tail private String shopName; private int numOfOrder; The class should have the following methods: A constructor that initializes the market name shopName and sets num OfOrder to 0. . public boolean enqueue(String name, int items) Modify the given enqueue method to increment numOfOrder by 1, creates a Customer using numOfOrder as the orderID and adds a Customer in the queue. public void printi The method is given in the attached file. Do not make any changes to the method. private void enqueue() The method is given in the attached file. Do not make any changes to the method. public Customer dequeue() The method is given in the attached file. Do not make any changes to the method. public int queueSize(String name) Counts how many customers are in front of the customer with that name. Returns the count. public Customer MinItems() Returns the Customer with the minimum total items. public double average() Calculates the average of the total items in the queue and returns its value. 3) Write a test application named Exam Test. In the main method, display a menu of options as shown in the sample output: . . Class Waitingline Choice 1: Ask the user to enter the customer information and call method enqueue. If the method returns false, display an error message Error adding customer. Choice 2: Call method print Choice 3: Ask the user to enter the customer name and call method queueSize and print the result Choice 4: Call method MinItems and print the result. Choice 5: Call method average and print the result. Choice 6: Exit the program. Criteria Max Mark Class Customer 10.00 Sample Output Instant variables 3.00 constructor 2.00 Choose: Update method 1. Add a Customer 2. Print all Customers enqueue 10.00 3. Find queue size queueSize method 10.00 4. minimum items minltems method 10.00 5. Find average Average method 10.00 6. Exit Class ExamTest 25.00 1 5.00 Enter the customer name: Fatma Syntax Errors Enter the total items: 5 Output 5.00 Choose: Total 100.00 1. Add a Customer 2. Print all Customers 3. Find queue size 4. minimum items 5. Find average 6. Exit 1 Enter the customer name: Ali Enter the total items: 10 Choose: 1. Add a Customer 2. Print all Customers 3. Find queue size 4. minimum items 5. Find average 6. Exit 1 Enter the customer name: Sara

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!