Question
Write a program that manages computer stations in computer labs.The following is a list of allcomputer labs and the available stations in each lab: Lab
Write a program that manages computer stations in computer labs.The following is a list of allcomputer labs and the available stations in each lab:
Lab 1:PC 1, PC2, PC3
Lab2: PC 1, PC2, PC3, PC4, PC5
Lab 3: PC 1, PC2, PC3, PC4
Lab 4: PC 1, PC2, PC3, PC4, PC5, PC6, PC7
Lab 5: PC 1, PC2, PC3, PC4
The program must have a menu with threemainoptions: 1.to log on to a computer,2.to log offfrom a computer, and3.to view anoverview off all computer stations.The fourth option is toenter-1 to end the program.The log on option prompts the userto entertheirID and thenmarks the computer as occupied with the ID. The log off option prompts the user to enter their5-digit ID and then marks the computer as occupied with the ID.The overviewshows allavailable computer stationsandfor those that are occupied, it shows the ID.
Hints: Use int* labStations [ LAB_COUNT]; The static array of type int* rep resents the five labs. Each int* element represents a dynamically allocated array of type int which represents the computer stations for that lab. Initialize each element in the dynamic array to -1. When a user logs on, store the ID at the index of the computer stations. Set it back to -1 when the user logs out.
Use a separate array to store the number of total computer stations for each lab.
Example:
Menu:
1. Log on to PC
2.Log off from PC
3. Show available PCs
-1 Quit
Select an option: 3
Info:
Lab 1: PC1, PC2, PC3
Lab 2: PC1, PC2, PC3, PC4, PC5
Lab 3: PC1, PC2, PC3, PC4
Lab 4: PC1, PC2, PC3, PC4, PC5, PC6, PC7
Lab 5: PC1, PC2, PC3, PC4
Menu:
1.Log on to PC
2.Log off from PC
3.Show available PCs
-1 Quit
Select an option: 1
3
Select a lab (1-5): 4
Select a PC (1-7): 1
Enter your ID: 38294
You are now logged on.
Menu:
1.Log on to PC
2. Log off from PC
3. Show available PCs
-1 Quit
Select an option: 8
Menu:
1.Log on to PC
2.Log off from PC
3.Show available PCs
-1 Quit
Select an option: 3
Info:
Lab 1: PC1, PC2, PC3
Lab 2: PC1, PC2, PC3, PC4, PC5
Lab 3: PC1, PC2, PC3, PC4
Lab 4: 38294, PC2, PC3, PC4, PC5, PC6, PC7
Lab 5: PC1, PC2, PC3, PC4
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