Question

Computer Labs Write a Computer Labs program to store the list of user IDs for each computer station using a linked list. Problem Description: You run four computer labs. Each lab contains computer stations that are numbered as shown in the table below: Lab Number Computer station Numbers 1-5 2 1-6 1-4 4 1-3 Each user has a unique five-digit ID number. Whenever a user logs on, the Users ID, labnumber, and the computer station number are transmitted to your system. For example, ifuser 56283 logs onto station 2 in lab 3, then your system receives (56283, 2, 3) as input data. Similarly, when auser logs off a station, then your system receives the lab number and computer station number. Write a computer program that could be used to track, by lab, which user is logged onto which computer. For example, if user 56283 is logged into station 2 in lab 3 and user 67315 is logged into station 1 of lab 4 then your system might display the following: Lab number Computer Stations Numbers 1: empty 2: empty 3: empty: 4: empty: 5: empty 1: empty 2: empty 3: empty: 4: empty: 5: empty 6: empty 1: empty 2: 56283 3: empty: 4: empty 1: 67315 2: empty 3: empty Create a menu allows the administrator to simulate the transmission of information by manually typing in the login or log off data. Whenever someone logs in or out, the display should be

Please post the code in c++!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Executable code:

#include <iostream>

#include <iomanip>

using namespace std;

void init(int *labs[], int num_stations[], int number_used);

void menu(int *labs[], int num_stations[], int number_used);

/*STATION*/

void track_display(int *labs[], int num_stations[], int number_used);

void delete_array(int *labs[], int num_stations[], int number_used);

void log_on(int *labs[]);

void log_off(int *labs[]);

void info_transmission(int *labs[], int ID, int lab, int mystat);

/*MAIN METHOD*/

int main()

{

const int num_labs = 4;


int num_stations[num_labs] = {5,6,4,3};

  
int *labs[num_labs];

init(labs, num_stations, num_labs);

menu(labs, num_stations, num_labs);

return 0;


}

void init(int *labs[], int num_stations[], int number_used)

{

for (int s = 0; s < number_used; s++)

{

labs[s] = new int[num_stations[s]]();

}

}

void menu(int *labs[], int num_stations[], int number_used)

{

int option;

do

{

cout << "\n Display Chart \n"

<< "Pick 0 to quit \n"

<< "Pick 1 to simulate login \n"

<< "Pick 2 for simulate logout \n"

<< "Pick 3 for search \n"

<< "Enter your option and press return: ";

cin >> option;

switch(option)

{

case 0:

track_display(labs, num_stations, number_used);

break;

case 1:

log_on(labs);

break;

case 2:

log_off(labs);

break;

case -1:

cout << "End of Program. \n";

delete_array(labs, num_stations, number_used);

break;

default:

cout << "Not a valid option. \n"

<< "Pick again.\n";

}

}

while (option != -1);

}

void track_display(int *labs[], int num_stations[], int number_used)

{

cout << endl << setw(12) << left << "Lab Number" << "Computer Stations\n";

for(int m = 0; m < number_used; m++)

{

cout << setw(12) << left << m+1;

for (int s = 0; s < num_stations[m]; s++)

{

cout << s+1 << ": ";

if (labs[m][s] == 0)

{

cout << setw(6) << left << "empty";

}

else

{

  

cout << setw(6) << labs[m][s];

}

}

cout << endl;

}

}

void delete_array(int *labs[], int num_stations[], int number_used)

{


for (int s = 0; s < number_used; s++)

{

delete []labs[s];

}

}

void log_on(int *labs[])

{


int ID, lab, mystat;

  

cout << "Enter the 5 digit ID number of the user logging in: ";

cin >> ID;

cout << "Enter the lab number the user is logging in from (1-4): ";

cin >> lab;

cout << "Enter computer station number the user is logging in to: ";

cin >> mystat;

info_transmission (labs, ID, lab-1, mystat-1);

cout << "Successfully log on";

}

void log_off(int *labs[])

{

int lab, mystat;

cout << "Enter computer station number the user is logging in to: ";

cin >> lab;

cout << "Enter the lab number the user is logging in from (1-4): ";

cin >> mystat;

info_transmission (labs, 0, lab-1, mystat-1);

cout << "Effectively log off";

}   

void info_transmission(int *labs[], int ID, int lab, int mystat)

{


labs[lab][mystat] = ID;

}

Output:

Add a comment
Know the answer?
Add Answer to:
Please post the code in c++! Computer Labs Write a Computer Labs program to store the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write the following program in C++ You run four computer labs, Each lab contains computer stations...

    Write the following program in C++ You run four computer labs, Each lab contains computer stations that are numbered as shown in the table below: Lab Number Computer Station Numbers 1 1 - 5 2 1 - 6 3 1 - 4 4 1 - 3 Each user has a unique five-digit ID number. Whenever a user logs on, the user’s ID, lab number, and the computer station number are transmitted to your system. For example, if user 49193 logs...

  • C++ program that could be used to track, by lab, who is logged into which computer

    C++ program that could be used to track, by lab, who is logged into which computer 1. |15 points| Suppose you run four computer labs. Each lab contains computer stations that are numbered as shown in the table below Lab Number |Computer Station Numbers 1-5 2 1-4 1-3 Each user has a unique five-digit ID number. Whenever a user logs on, the user's ID, lab number, and the computer station number are transmitted to your system. For instance, if user...

  • JAVA Programming Assignment: You run four computer labs. Each lab contains computer stations that are numbered...

    JAVA Programming Assignment: You run four computer labs. Each lab contains computer stations that are numbered as shown in the table below:- Lab Number   Computer Station Numbers 1   1-5 2   1-6 3   1-4 4   1-3 Each user has a unique five-digit ID Number. Whenever a user logs on, the user's ID, Lab Number, and the computer station are transmitted to your station. For example, if user 49193 logs onto station 2 in Lab 3, your system receives (49193, 2, 3)...

  • Java Computer Labs Assignment! The code NEEDS to be commented properly! Every class file should have a header comment that includes your name and assignment number and briefly documents what the prog...

    Java Computer Labs Assignment! The code NEEDS to be commented properly! Every class file should have a header comment that includes your name and assignment number and briefly documents what the program does! If there are known deficiencies with your program such as known problems or incomplete features, these should be clearly listed in the header comment! Every method should have a method header comment that documents what the method does, what its parameters are, and what it returns! You...

  • computer science

    CSCI 3000 Homework 4In 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 computersHere is a sample state of the system:Lab ArraySome of the computers are free (no...

  • In this assignment, you will implement a simple version of Computer Lab administration system in C++....

    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...

  • #include <iostream> #include <cstdlib> using namespace std; int **dynArray(int row, int cols) { int **myPtr; int...

    #include <iostream> #include <cstdlib> using namespace std; int **dynArray(int row, int cols) { int **myPtr; int lab[4]; myPtr = new int *[row]; for(int i = 0; i < row; i++) myPtr[i] = new int[lab[i]]; for(int i = 0; i<row ; i++) if(myPtr[i] == 0) cout<<"empty"; return myPtr; } void getinput(int ID,int &Station,int &labnumb) { cout<<" Enter your ID number: "<<endl; cin>>ID; cout<<" Enter your station number: "<<endl; cin>>Station; cout<<" Enter your lab number: "<<endl; cin>>labnumb; return; } void logout(int ID,int...

  • write a code on .C file Problem Write a C program to implement a banking application...

    write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...

  • Create the Python code for a program that will simulate a basic car radio with 3...

    Create the Python code for a program that will simulate a basic car radio with 3 presets and 5 stations to tune in. You will create methods (class functions) for the following: __init__ AND __str__ seekNext longPressPreset1 through 3 shortPressPreset1 through 3 displayLCD You will create program functions for the following: main displayMenuGetOption Additional notes: You MUST use the program template. Your messages and prompts should look EXACTLY like those in the sample. Duplicating all blank lines and spacing. You...

  • Language: C++ PLEASE INCLUDE SCREENSHOT OF OUTPUT In this assignment, you will consider the problem of organizing a collection of computer user-ids and passwords. Each time a user logs in to the syste...

    Language: C++ PLEASE INCLUDE SCREENSHOT OF OUTPUT In this assignment, you will consider the problem of organizing a collection of computer user-ids and passwords. Each time a user logs in to the system by entering his or her user-id and a secret password, the system must check the validity of this user-id and password to verify that this is a legitimate user. Because this validation must be done many times each day, it is necessary to structure this information in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT