C++ program that could be used to track, by lab, who is logged into which computer
//code self understandable
#include <bits/stdc++.h>
#define LAB_NO 4
#define FIRST_LAB 5
#define SECOND_LAB 6
#define THIRD_LAB 4
#define FOURTH_LAB 3
using namespace std;
void print(int** lab)
{
cout<<"LAB STATUS"<<endl;
cout<<"LAB# "<<"Computer
Stations"<<endl;
cout<<"1 ";
for(int i=0;i<5;i++)
{
if(lab[0][i]==0)
cout<<i+1<<": empty
";
else
cout<<i+1<<":
"<<lab[0][i]<<" ";
}
cout<<endl;
cout<<"2 ";
for(int i=0;i<SECOND_LAB;i++)
{
if(lab[1][i]==0)
cout<<i+1<<": empty
";
else
cout<<i+1<<":
"<<lab[1][i]<<" ";
}
cout<<endl;
cout<<"3 ";
for(int i=0;i<THIRD_LAB;i++)
{
if(lab[2][i]==0)
cout<<i+1<<": empty
";
else
cout<<i+1<<":
"<<lab[2][i]<<" ";
}
cout<<endl;
cout<<"4 ";
for(int i=0;i<FOURTH_LAB;i++)
{
if(lab[3][i]==0)
cout<<i+1<<": empty
";
else
cout<<i+1<<":
"<<lab[3][i]<<" ";
}
cout<<endl;
}
void search(int user_id,int** lab)
{
for(int i=0;i<FIRST_LAB;i++)
{
if(lab[0][i]==user_id)
{
cout<<"User "<<user_id<<" is in lab 1 at computer
"<<i+1<<endl;
return;
}
}
for(int i=0;i<SECOND_LAB;i++)
{
if(lab[1][i]==user_id)
{
cout<<"User "<<user_id<<" is in lab 2 at computer
"<<i+1<<endl;
return;
}
}
for(int i=0;i<THIRD_LAB;i++)
{
if(lab[2][i]==user_id)
{
cout<<"User "<<user_id<<" is in lab 3 at computer
"<<i+1<<endl;
return;
}
}
for(int i=0;i<FOURTH_LAB;i++)
{
if(lab[3][i]==user_id)
{
cout<<"User "<<user_id<<" is in lab 4 at computer
"<<i+1<<endl;
return;
}
}
cout<<"User "<<user_id<<" is not
present in any of the labs"<<endl;
return;
}
int main() {
// your code goes here
int** lab=new int*[4];
lab[0]=new int[FIRST_LAB];
lab[1]=new int[SECOND_LAB];
lab[2]=new int[THIRD_LAB];;
lab[3]=new int[FOURTH_LAB];
memset(lab[0],0,FIRST_LAB*sizeof(int));
memset(lab[1],0,sizeof(lab[1]));
memset(lab[2],0,sizeof(lab[2]));
memset(lab[3],0,sizeof(lab[3]));
while(1<2)
{
cout<<"MAIN
MENU"<<endl;
cout<<")0
QUIT"<<endl<<"1) SIMULATE LOGIN"<<endl<<"2)
SIMULATE LOGOFF"<<endl<<"3) SEARCH"<<endl;
int choice;
cin>>choice;
if(choice==0)
break;
else if(choice ==1)
{
int
user_id,lab_no,computer_no;
cout<<"Enter the 5 digit ID number of the user logging in
";
cin>>user_id;
cout<<"Enter the lab number the user is logging in from(1-4)
";
cin>>lab_no;
cout<<"Enter the computer station number the user is logging
in to(1-6) ";
cin>>computer_no;
lab[lab_no-1][computer_no-1]=user_id;
print(lab);
}
else if(choice==2)
{
int
lab_no,computer_no;
cout<<"Enter the lab number the user is logging of from(1-4)
";
cin>>lab_no;
cout<<"Enter the computer station number the user is logging
of to(1-6) ";
cin>>computer_no;
lab[lab_no-1][computer_no-1]=0;
print(lab);
}
else if(choice==3)
{
int
user_id;
cout<<"Enter the 5 digit ID number of the user to find
";
cin>>user_id;
search(user_id,lab);
}
}
return 0;
}
C++ program that could be used to track, by lab, who is logged into which computer
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 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...
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...
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...
#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...
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...
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...
PLease IN C not in C++ or JAVA, Lab3. Write a computer program in C which will simulate a calculator. Your calculator needs to support the five basic operations (addition, subtraction, multiplication, division and modulus) plus primality testing (natural number is prime if it has no non-trivial divisors). : Rewrite your lab 3 calculator program using functions. Each mathematical operation in the menu should be represented by a separate function. In addition to all operations your calculator had to support...
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...
Java 7.17 Clone of LAB*: Program: Soccer team roster This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0-99, but this is NOT enforced by the program nor tested) and the player's rating (1-9, not enforced like jersey numbers). Store the jersey numbers in one int array and the ratings in another int...