Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
Question
Book Icon
Chapter 13, Problem 8PP
Program Plan Intro

Creation of program to simulate customer arrivals at motor vehicles department

Program Plan:

  • Define a class “Queue” to denote methods and operations required for queue.
    • Declare variables that are required for program.
    • Define a constructor “Queue()” and assign values.
    • Define a method “Enqueue()” to insert values into a queue.
    • Define a method “Dequeue()” to remove value from a queue.
    • Define a method “Front()” to return front element of queue.
    • Define a method “Size()” to return size of queue.
    • Define a method “isEmpty()” to check whether queue is empty or not.
    • Define a main method
      • Call method “Enqueue()” to insert values into a queue.
      • Call method “Dequeue()” to remove value from a queue.
      • Call method “Front()” to return front element of queue.
      • Call method “Size()” to return size of queue.
      • Call method “isEmpty()” to check whether queue is empty or not.
      • Loop until the user needs to compute result.
      • To simulate customer arrival call “Enqueue()” method with required parameters.
      • To help next customer call “Dequeue()” method.

Blurred answer
Students have asked these similar questions
QUESTION 9 Write a complete Java program to implement a QUEUE in a bank using LinkedList class as follows: • Provide the menu as shown below; use an infinite loop; stop when user opts 4. 1. Add a customer 2. Remove a customer 3. Show the queue 4. Exit • Add a customer should add an int number at the end of queue using the method addLast(). • Remove a customer should delete the int from front using the method removeFirst(). Show the queue should display the numbers in queue using the method System.out.printIn(). For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac).
An airport has a runway for airplanes landing and taking off. When the runway is busy, airplanes wishing to take off or land have to wait. Landing airplanes get priority, and if the runway is available, it can be used. Implement a Java class, Airport.java, for this simulation, using two appropriate lists, one for the airplanes waiting to take off and one for those waiting to land. Note that the data structures you select for the two lists must be suitable for this purpose. For instance, the sooner an airplane comes for landing, the sooner it will land. Also, you must keep the record of all the airplanes that have already landed or taken off in one single list, to print out the activity log whenever asked, such that the sooner an airplane landed, the later it shows in the printout. To get a clear idea, please have a close look at the expected outputs of the execution of the tester class provided. The user enters the following commands: (The user entry has already been done in the tester…
Write a main() method for the QuickSort class. Create a queue of Item objects and sort them in increasing order. Populate the queue with several Account/Item objects and then call the quicksort method. The Account class has the following instance variables: int accountNumber String customerName double accountBalance   The Item class has the following instance variables: int itemId; String itemName double itemPrice   Note: This is JAVA PROGRAMMING
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning