Question

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 onto station 2 in lab 3, then your system receives (49193, 2, 3) as input data. Similarly, when a user logs off a station, then your system receives the lab number and the 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 49193 is logged into station 2 in lab 3 and user 99577 is logged into station 1 of lab 4, then your system might display the following: Lab# Computer Stations 1 1: empty 2: empty 3: empty 4: empty 5: empty 1 1: empty 2: empty 3: empty 4: empty 5: empty 6:empty 3 1: empty 2: 49193 3: empty 4: empty 4 1: 99577 2: empty 3: empty Create a menu that allows the administrator to stimulate the transmission of information by manually typing in the login of logoff data. Whenever someone logs in or out, the display should be updated. Also write a search option so that the administrator can type in a user ID and the system will output what lab and station number that user is logged into, or “None” if the user ID is not logged into any computer station. You should use a fixed array of length 4 for the labs. Each array entry points to a dynamic array that stores the user login information for each respective computer station. The structure is shown in the figure below. This structure is sometimes called a ragged array since the columns are of unequal length.

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

[#include<iostream>

using namespace std;

int *Point;

void screen1();

void logon();

void logoff();

int main(){

screen1();

int entry;

cout<<endl;

do{

cout<<"1: Logon\n"

<<"2: Logoff.\n"

<<"3: Search.\n"

<<"4: End\n";

cout<<"Enter a number: ";

cin>>entry;

if(entry==1){

logon();

}

if(entry==2){

logoff();

}

}while(entry<=3);

cout<<endl;

system("pause");

}

void screen1(){

int station1[5],station2[6],station3[4],station4[3];

int lab[5];

for(int x=1;x<=4;x++){

if(x==1){

station1[5];

for(int f=1;f<=5;f++){

station1[f]=0;

}

}

if(x==2){

station2[6];

for(int f=1;f<=6;f++){

station2[f]=0;

}

}

if(x==3){

station3[4];

for(int f=1;f<=4;f++){

station3[f]=0;

}

}

if(x==4){

station4[3];

for(int f=1;f<=3;f++){

station4[f]=0;

}

}

}

int h=1;

for(int a=1;a<=4;a++){

cout<<h<<": ";

if(a==1){

for(int f=1;f<=5;f++){

if(station1[f]==0){

cout<<f<<" empty ";

}

}

cout<<endl;

}

if(a==2){

for(int f=1;f<=6;f++){

if(station2[f]==0){

cout<<f<<" empty ";

}

}

cout<<endl;

}

if(a==3){

for(int f=1;f<=4;f++){

if(station3[f]==0){

cout<<f<<" empty ";

}

}

cout<<endl;

}

if(a==4){

for(int f=1;f<=3;f++){

if(station4[f]==0){

cout<<f<<" empty ";

}

}

cout<<endl;

}

h++;

}

}

void logon(){

int id,station,lab;

cout<<"Enter your 5 digit User ID: ";

cin>>id;

cout<<endl;

cout<<"Enter the lab number: ";

cin>>lab;

cout<<endl;

switch(lab){

case 1:

cout<<"Enter your station(1-5)\n";

cin>>station;

if(station>5){

cout<<"Invalid station!\n";

}

else{

break;

}

case 2:

cout<<"Enter your station(1-6)\n";

cin>>station;

if(station>6){

cout<<"Invalid station!\n";

}

else{

break;

}

case 3:

cout<<"Enter your station(1-4)\n";

cin>>station;

if(station>4){

cout<<"Invalid station!\n";

}

else{

break;

}

case 4:

cout<<"Enter your station(1-3)\n";

cin>>station;

if(station>3){

cout<<"Invalid station!\n";

}

else{

break;

}

}

}

void logoff(){

int id;

cout<<"Enter your User ID to logoff: ";

cin>>id;

cout<<endl;

}

Add a comment
Know the answer?
Add Answer to:
Write the following program in C++ You run four computer labs, Each lab contains computer stations...
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
  • 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)...

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

  • Please post the code in c++! Computer Labs Write a Computer Labs program to store the...

    Please post the code in c++! 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 User's ID, labnumber, and the computer...

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

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

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

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

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

  • 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(),...

  • 1. Write the command to set the following permissions on a script file with the following...

    1. Write the command to set the following permissions on a script file with the following name; myscript.sh Owner: full access; read, write and execute Group: read and execute Other: no access 2. Create a new file with the name "myfirstscript.sh". Write a new script that performs the following tasks in sequence; Display the usernames of currently logged in users; sorted from a-z HINT: You will need to filter the output of the whocommand Display a list of usernames who...

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