Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program for a Car parking lot using a container class you learned last week and and dynamical memory allocation you learned this week.
Write a program for a Car parking lot using a container class you learned last week and and dynamical memory allocation you learned this week. You will fulfill the following requirements
- The Car Parking lot has initial capacity of 20 parking spaces (Use size 20 array of Car objects )
- The parking spaces are numbered from 1 to 20 (Parking lot initial capacity is 20)
- You will assign the parking space to a car when it enters the parking lot
- You will mark the space empty when the car vacate the parking space
- Once the parking lot is full (Lot has 20 Cars). You will open another parking lot area by doubling the capacity of the parking lot. (You will dynamically expand the size of the parking lot array. At this stage you can allow 40 cars in the parking lot)
- Your program should be able to report at any time number of spaces that are occupied and number of vacant spaces
- At night your program should empty the Parking Lot (Assume any car parked after hours will be towed away)
- Make sure you free the memory allocated to the array.
Write a driver program to test the requirements
C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started