Question
In this assignment, you will implement a simple version of Computer Lab administration system in C++. Your program will monitor computers in 4 computer labs
In this assignment, you will implement a simple version of Computer Lab administration system in C++. Your program will monitor computers in 4 computer labs and will allow users to log in and log out. Each computer lab has different number of computers.
Lab 1 has 10 computers
Lab 2 has 6 computers
Lab 3 has 3 computers
Lab 4 has 12 computers
Here is an example state of the system:
Lab Array
Some of the computers are free (no one logged in), and some others are occupied by students.
In the implementation, you will define a Lab array (an array of string pointers) in the stack memory. This pointer array can be local to the main function or it can be a global. And each pointer in the array will point to a string array that is dynamically allocated from the heap memory. (Size of each array is given above)
Initially, all computers in all labs will be set to Free state. Then you will provide a menu to the user such as
Print the current status of computers in all labs
Log in a new student to a computer in a lab
Ask user name, the lab number, and the computer number. If it is available, log that student in.
Log out a student from his/her computer in a lab
Ask user the lab number and the computer number. If the computer is occupied, log that student out.
Exit
Add N new computers to a lab.
: Here you will ask user the lab number and the how many new computers (N) to add. Then you will add those computers to the lab without losing the current content (logged in students).
Example Case for Menu option 2:
If the current state of the labs as given in first figure, and if a new student Kim wants to log in to computer 3 in Lab 3, you will update the corresponding element in the correct array by writing students name. The new state of the labs will be
Another example would be logging out a student from the computers. In that case, the student name will be replaced with the word Free in the array.
there should be two ways to logout.
PC1 Free PC2 Free PC3 Free PC4 ack PC5 Free PC6 Free PC7 Mary PC8 Free PC9 Free PC10 Alice Lab 1 PC1 Lab 2 PC2 John PC3 Free PC4 Free PC5 Mike PC6 Free Free PC1 Free PC2 Free PC3 Free Lab 3 PC1 Free PC3 Free PC4 Free PC6 Free PC7 Free PC11 PC2 Tom PC5 Tim PC8 Free PC9 Jimm PC10 Kate PC12 Free Lab 4 FreeStep 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