Problem Solving with C++ plus MyProgrammingLab with Pearson eText-- Access Card Package (9th Edition)
Problem Solving with C++ plus MyProgrammingLab with Pearson eText-- Access Card Package (9th Edition)
9th Edition
ISBN: 9780133862218
Author: Walter Savitch
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
You need to insert the numbers2,4,3,7, one at a time in that order into to an initially empty queue. Represent that process using the standard constructors EmptyQueue and push. Show, in the standard two-cell notation, the resulting queue. What is the result of the operation top on that queue? What is the result of the operation pop on the original queue you created? What is the result of the operation pop followed by pop followed by top on the original queue you created?
Write a Java public static general method that doesn't belong to the Queue class(assuming the Queue type is Book and Book has a clone method, Book also has a method called getGenre() which returns the genre of the book): Queue findOneGenreBooks(Queue Q, String genreType) that searches in the first parameter Q for all books that has the same genre type as defined by the second parameter genreType, return all of the books that have the specified genre type as a Queue. (For example, you may want to find all cartoon books and return them as a Queue). Please note: You are only allowed to use the Queue class which has constructors, enqueue, dequeue, front, isEmpty, size, toString, and clone methods.
Modify the simulate() method in the Simulator class to work with the revised interface of ParkingLot and the new peek() method in Queue. In addition, implement the getIncomingQueueSize() method of Simulator using the size() method of Queue. The getIncomingQueueSize() is going to be used in the CapacityOptimizer class (next task) to determine the size of the incoming queue after a simulation run.   CODE TO MODIFY IN JAVA: public class Simulator { /** * Length of car plate numbers */ public static final int PLATE_NUM_LENGTH = 3; /** * Number of seconds in one hour */ public static final int NUM_SECONDS_IN_1H = 3600; /** * Maximum duration a car can be parked in the lot */ public static final int MAX_PARKING_DURATION = 8 * NUM_SECONDS_IN_1H; /** * Total duration of the simulation in (simulated) seconds */ public static final int SIMULATION_DURATION = 24 * NUM_SECONDS_IN_1H; /** * The probability distribution for a car leaving the lot based on the duration * that the car has been parked in…
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