Question

The CSC326 parking garage contains 2 lanes, each capable of holding up to 10 cars. There...

The CSC326 parking garage contains 2 lanes, each capable of holding up to 10 cars. There is only a single entrace/exit to the garage at one end of the lanes. If a customer arrives to pick up a car which is not nearest the exit, all cars blocking the car's path are moved into the other lane. If more cars still must be moved out of the way, they go into the street. When the customer's car is driven out, all cars in the street must be put back into the garage.

Write a C++ program that reads input from either a file(that you create). Each line in the file contain two fields seperated by a blank: a code(A = an arriving car, or D = a car wishes to depart) and a license plate number (this could be a string). Cars are assumed to arrive and depart in the order specified by the input. The program should print a message whenever a car arrives or departs.

When a car arrives, the message should specify whether or not there is room in the garage for the car. If there is no room, the car leaves without entering. When a car departs, the message should include the number of times the car had to be moved out of the wway so that other cars could depart. Each move from one lane to the other counts as 1: each move to the street counts as 1: each move form the stree to a lane counts as 1: Don't forget to check for screwy things~ e.g someone wanting a car that's not in the garage, trying to park a car but both lanes are full, trying to park a car when only one lane is full, etc.

Your program should define objects from a 'lane' class to represent the 2 lanes and the street. The lane class will contain three stack objects one for each lane and the street. Represent the cars in each lane using a car class. The car class can contain variables that hold its license plate, and the number of times it's moved. You'll need methods for manipulating the cars in the lanes e.g. search for a car in a lane, move a car from a lane to somewhere, and perhaps higher-level methods like arrive and depart and methods to handle your output. This in NOT a complete list of methods needed, so feel free to experiment and expand the class definitions as much as you like. Now use linked list to implement this garage problem.

The question is about stack and not queue.

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
The CSC326 parking garage contains 2 lanes, each capable of holding up to 10 cars. There...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • The Bashemin Parking Garage contains a single lane that can hold up to ten cars. Arriving...

    The Bashemin Parking Garage contains a single lane that can hold up to ten cars. Arriving cars enter the garage at the rear and are parked in the empty space nearest to the front. Departing cars exit only from the front. If a customer needs to pick up a car that is not nearest to the exit, then all cars blocking its path are moved out temporarily, the customer's car is driven out, and the other cars are restored in...

  • The laughs parking garage contains a single lane that hold up to ten cars. Cars arrive...

    The laughs parking garage contains a single lane that hold up to ten cars. Cars arrive at the south end of the garage and leave from the north end. If a customer arrives to pick up a car that is not northernmost, all the cars to the north of his car are moved out, his car is driven out, and the others cars are restored in the same order that they were in originally. Whenever a car leaves, all the...

  • The Parking Garage Problem

    The Scratchemup parking garage contains a single lane that holds up to 10 cars. Cars arrive at the south end of the garage and leave from the north end. If a customerarrives to pick up a car that is not the northernmost, all cars to the north of his car are moved out, her car is driven out, and the other cars are restored in thesame order that they were in originally. Whenever a car leaves, all cars to the...

  • PLease, I need help with this Code. PLease create correctly documentations comments for better understanding. This...

    PLease, I need help with this Code. PLease create correctly documentations comments for better understanding. This is the input: JAV001 ARRIVE JAV002 ARRIVE JAV003 ARRIVE JAV004 ARRIVE JAV005 ARRIVE JAV001 DEPART JAV004 DEPART JAV006 ARRIVE JAV007 ARRIVE JAV008 ARRIVE JAV009 ARRIVE JAV010 ARRIVE JAV011 ARRIVE JAV012 ARRIVE JAV013 ARRIVE JAV014 ARRIVE JAV006 DEPART JAV014 DEPART JAV013 DEPART JAV005 DEPART JAV015 ARRIVE JAV010 DEPART JAV002 DEPART JAV015 DEPART JAV014 DEPART JAV009 DEPART JAV003 DEPART JAV008 DEPART JAV007 DEPART JAV012 DEPART JAV011...

  • Question: How can I solve it in "Java program"?, i need test code also. Define Pi...

    Question: How can I solve it in "Java program"?, i need test code also. Define Pi to be a parking lane i in a parking lot and carj to be the jth car; where the number of lanes in a parking lot is 4 and there are 7 cars to park. 1<= i<=4, and Cj: 1<=j<=7. Assume that all lanes are of the same length, and all cars are also of the same length, hence, the same number of cars...

  • Overview For this assignment, we will practice using stacks and queues. In this exercise, you will...

    Overview For this assignment, we will practice using stacks and queues. In this exercise, you will create two stacks and a queue to keep track of cars using a parking lot. We will use the nature of the stacks and queues to solve the problem. Specifications Rules FIU has opened a new valet parking lot next to the PC building that requires a special decal to park. If the car does not have the correct parking decal, the driver should...

  • Overview For this assignment, we will practice using stacks and queues. In this exercise, you will...

    Overview For this assignment, we will practice using stacks and queues. In this exercise, you will create two stacks and a queue to keep track of cars using a parking lot. We will use the nature of the stacks and queues to solve the problem. Specifications Rules FIU has opened a new valet parking lot next to the PC building that requires a special decal to park. If the car does not have the correct parking decal, the driver should...

  • A parking garage charges a $2.00 minimum fee to park for up to three hours. The...

    A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour in excess of these initial three hours. The maximum charge for any given 24 hour period is $10.00. Assume no car parks for longer than 24 hours at a time. Write a program that calculates and prints the total parking charges for the customers who parked their cars in this garage (at least 4 cars) and the...

  • Programming Assignment #2 (Arrays) I. The Assignment This assignment is to take your Garage class from...

    Programming Assignment #2 (Arrays) I. The Assignment This assignment is to take your Garage class from the previous assignment and modify it so that it uses an array of Car objects as the principal data structure instead of an ArrayList-of-Car. This is an example of the OOP principle of information hiding as your Car and test classes will not have to be modified at all. Unless you broke encapsulationon the previous assignment, that is   II. Specifications Specifications for all 3...

  • Questions Submission Question 2: Stacks Problem Write a program that keeps track of where cars are...

    Questions Submission Question 2: Stacks Problem Write a program that keeps track of where cars are located in a parking garage to estimate the time to retrieve a car when the garage is full. This program will demonstrate the following: How to create a list for use as a stack, How to enter and change data in a stack. Solving the Problem Step 1 In Python, the stack data structure is actually implemented using the list data structure with a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT