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
I would like to implement a queue as a class with a linked list. This queue Is used to help the class print job in displaying things like: a confirmation of the job request received and the status ( denied/accepted) along with the details such as a tracking number, position in the queue( if accepted), reason for denial (if denied), etc. These classes will be used in a menu-driven application that has the following options: request a print job ask for the job name; the name may have blank spaces and consist of alphanumeric characters only, must start with a letter display a confirmation of the job request received and the status ( denied/accepted) along with the details such as a tracking number, position in the queue( if accepted), reason for denial (if denied), etc execute a print job (remove from the queue ) display a confirmation along with the tracking number, the name of the print job, and the number of  print jobs currently in the queue display number of print jobs…
Imagine a ballroom with two kinds of dancers: leaders and followers. Dancers of both kinds wait in two separate queues before entering the dance floor. When a leader arrives, it checks to see if there is a follower waiting. If so, they can both proceed. Otherwise it waits. Similarly, when a follower arrives, it checks for a leader and either proceeds or waits, accordingly. Make sure that the next pair of leader/follower may dance only after the previous pair is done.Write the pseudocode for leaders and followers that enforces these constraints.
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).
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