Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!