Question: In C A . Struct Definitions: You must use the following struct definitions. You are free to add more fields if you anticipate. typedef struct
In C
A Struct Definitions: You must use the following struct definitions. You are free to add more fields if you
anticipate.
typedef struct RegisteredVehiclefor one registered vehicle
char licenseplate; to be used for string license plate# of the vehicle
char ownername; to be used for storing owner name
RegisteredVehicle;
typedef struct Garagefor one garage
char garagename; to be used for garage name
int totalcapacity; total capacity of the garage
int currentcount; number of vehicles in the garage in a particular time
RegisteredVehicle parkedvehicles; list of parked vehicles in a particular time
Garage;
typedef struct Campus
Garage garages; list of garages in campus
int totalgarages; number of garages in the campus
RegisteredVehicle registeredvehicles; list of registered vehicles
int totalregisteredvehicles; total number of registered vehicles
Campus;
B Commands:
The parking system should support the following commands:
a PARK : This command parks the car with license plate LP to garage G
i If the garage is full, it should print FULL
ii Otherwise, print PARKED after successfully parking the vehicle at garage G
iii. It is guaranteed that the license plate and garage will be available in the
system before processing this command
b UTILIZATIONREPORT: this prints the utilization report in the following format.
Garage: Capacity: Occupied: Utilization:
Garage: Capacity: Occupied: Utilization:
Garage: Capacity: Occupied: Utilization:
Where, is the garage name, is the capacity of garage Gx is count of vehicles at
and is the percentage of utilization of the garage Gx has to be displayed in decimal places.
Use double data type in this calculation.
After printing the above summary, you should print the name of garage which is utilized least at that time
based on utilization percentage, on a new line: Least Utilized: If multiple garages have the same
minimum percentage of the utilization, then you should print the one that came first in the inputs.
c RESIZE : This command resizes the capacity of garage with the new capacity
i If the new capacity is smaller than the number of vehicles in the garage, then it should
print FAIL TOO SMALL TO ACCOMMODATE EXISTING VEHICLES.
ii Otherwise, it should print SUCCESS after resizing the garage
iii. This command may require to use realloc
iv It is guaranteed that the garage will be available in the system before processing this
command
d SEARCHOWNER : This prints the license plates of the vehicles and the garages they are
parked for the vehicles owned by It prints the data in the following format:
NOT ON CAMPUS
Here, LPx is the license plate of the vehicles owned by and Gx is the garage where that car is
parked. The list should be displayed in the same order they are entered in the inputs. If a car is not parked
on campus, then it should display NOT ON CAMPUS for that vehicle.
If there is no registered car by this owner, then it should display NO REGISTERED CAR BY THIS
OWNER
A good idea would be using the displayVehiclesByOwner function to process this command
e RELOCATE : This command relocates the vehicle with license plate to garage It
is guaranteed that will be different than the current garage of the vehicle. It prints the following
message:
i If the target garage is not found, it should print NOT FOUND
ii If the vehicle is not in any garage, it should print NOT IN CAMPUS
iii. If the target garage is full, it should print G IS FULL. and should not remove the
vehicle from the current garage.
iv If the vehicle is successfully relocated, then print PARKED and in another line, it
should print RELOCATION SUCCESSFUL
v A good idea would be using the parkVehicle and removeVehicleFromGarage function in
this process.
f COUNTTOTAL: This command shows the total number of vehicles parked on the campus.
g REGISTERVEHICLE : This command registers a new vehicle with license plate
with the owner to the campus system. It is guaranteed that each license plate number
will be unique in the input. This command may require realloc!
The command will output the message REGISTERED after successfully adding the vehicle to the
campus system.
h REMOVEVEHICLEGARAGE : It removes the vehicle with license plage LP from the garage it
is located at that time. After removing the vehicle, it prints:
REMOVED FROM where is the garage where the vehicle was removed from.
If the vehicle was not found in any garage, then it prints:
NOT FOUND IN CAMPUS
i REMOVEGARAGE : It removes the garage from the campus. While removing, it frees the
memory and sub memory allocated to this garage. However, i
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
