Java Application Implement a restaurant waiting list applica

Java Application Implement a restaurant waiting list application with the following features/functionality:

Inputs for guest name, and number of people in the party. Additionally, you will generate a random number to simulate the time the guest spent waiting for a table. To keep things simple, you may assume wait times are whole minutes with a 1 minute minimum and 30 minute maximum. You will implement a class called Customer to hold this information.

Label controls to show the total time spent by all guests waiting. You will also compute and display the average wait time for all guests.

A list box to show all guest names, number of persons in the party and time they spent waiting. You will use the dequeue() method to retrieve each guest’s information from the queue. This feature is intended more for test/debug purposes. Guests must display in a first-in-first-out (FIFO) order.

You will implement a Queue class that will contain all guests. It must have the classic queue operations of enqueue() to place an item in the queue, dequeue() to remove an item from head of the queue, and first() to view the item at the head of the queue but not remove it. You may use a linked list of your own design, an array, the built-in Java Array List, or built-in Java Linked List as the underlying data structure. Your queue must also have size() and isEmpty() methods.

Your Queue must implement the Queue interface. You will create a class called QueueInterface with the queue methods above as abstract methods.

Solution

package model; class Table { private int id; private int numSeats; public Table(int id, int numSeats) { this.id = id; this.numSeats = numSeats; } public int getId() { return this.id; } public int getNumSeats() { return this.getNumSeats; } } class Restaurant implements Comparable { private String name; private List tables; public Restaurant(String name) { this.name = name; this.tables = new ArrayList
(); } public void addTable(Table t) { this.tables.add(t); } public void removeTable(int id) { for (Table t : this.tables) { if (t.getId() == id) { this.tables.remove(t); break; } } } public int getCapacity() { int capacity = 0; for (Table t : this.tables) { capacity += t.getNumSeats(); } return capacity; } public int compareTo(Restaurant r) { return this.name.compareTo(r.name); } }
Java Application Implement a restaurant waiting list application with the following features/functionality: Inputs for guest name, and number of people in the p

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site

© 2025 Homework Sourse • Study smart. Learn fast.