Debre Markos University: Institute of Technology
Debre Markos University: Institute of Technology
Institute of Technology
Department of Information Technology
2011 E.C
Start
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
string divider1 = "------------------------------------------------------------------------";
string divider2 =
"******************************************************************
******";
struct Student
{
string Name;
char ID[15];
string Dept;
string Date;
int Computer_No;
string Opinion;
};
int Student_Comment()
{
Student stud;
cin.ignore();
cout << "Enter your name: ";
getline(cin,stud.Name);
cout << "Enter ID: ";
cin.getline(stud.ID, 15);
cout<<"Enter your department: ";
getline(cin,stud.Dept);
cout << "Enter current date: ";
getline(cin, stud.Date);
cout << "Enter computer number:";
cin>>stud.Computer_No;
cin.ignore();
cout << "What is your issue related to the lab: ";//as an
assumption, just at this point the info input will be sent to the top manager as a
notification
getline(cin,stud.Opinion);
while(stud.Opinion.empty()==true)
{
cout << "...nothing entred..." << endl;
cout << "Feel free to enter your idea!"<< endl;
getline(cin,stud.Opinion);
}
cout <<divider2 << endl;
cout << "\tYour Comment has been successfully saved!"<<
endl;
cout << "\tThank you for your comment!!"<< endl;
cout << "\t\t--> We will try to address your issues as soon as
possible!" << endl;
cout <<divider2 << endl;
void Teacher()
{
int T_choice;
do{
cout << divider2<<endl;
cout << setw(30) <<"Welcome!" << endl;
cout << "What would you like to know about 2nd year students' IT lab? " <<
endl;
cout << "\t1. View how many computers function efficiently." << endl;
cout << "\t2. View how many doesn't function well." << endl;
cout << "\t3. View the total number of computers." << endl;
cout << "Your Choise Please(1-3): ";
cin >> T_choice;
cout << divider2 << endl;
if ((T_choice < 1 ) || (T_choice > 3))
{
cout << "Re-enter your choice:\n";
}
}while((T_choice < 1 ) || (T_choice > 3));
switch(T_choice)
{
case 1:
cout << "Based on our statistics, at the current time,\n there are --> 25
desktop computers which work efficiently. "<<endl;
cout << divider2 <<endl;
break;
case 2:
cout << "Based on our statistics, at the current time,\n there are --> 7
desktop computers which doesn't work efficiently. "<<endl;
cout << divider2 <<endl;
break;
case 3:
cout << "Based on our statistics, at the current time,\n there are --> 35
desktop computers in the lab."<<endl;
cout << divider2 <<endl;
break;
default:
cout << "Invalid Choise.";
}
}
void Lab_assistant_or_student()
{
int L_choice;
do{
cout << divider2<<endl;
cout << setw(30) <<"Welcome!" << endl;
cout << "What would you like to know about 2nd year students' IT lab? " <<
endl;
cout << "\t1. View how many computers function efficiently." << endl;
cout << "\t2. View how many doesn't function well." << endl;
cout << "\t3. View the total number of computers." << endl;
cout << "Your Choise Please(1-3): ";
cin >> L_choice;
cout << divider2 << endl;
if((L_choice<1)||(L_choice>3))
{
cout << "Re-enter your choice\n";
}
}while((L_choice<1)||(L_choice>3));
switch(L_choice)
{
case 1:
cout << "Based on our statistics, at the current time,\n there are --> 25
desktop computers which work efficiently. "<<endl;
cout << divider2 <<endl;
break;
case 2:
cout << "Based on our statistics, at the current time,\n there are --> 7
desktop computers which doesn't work efficiently. "<<endl;
cout << divider2 <<endl;
break;
case 3:
cout << "Based on our statistics, at the current time,\n there are --> 35
desktop computers in the lab."<<endl;
cout << divider2 <<endl;
break;
default:
cout << "Invalid Choise.";
}
int main()
{
int profession;
char subchoise;
string pas="dmu";
cout << "Enter Password(hint- dmu): "<<endl;
cin >> pas;
while(pas!="dmu")
{
cout << "Incorrect password!" << endl;
cout << "See hint and try agin"<<endl;
cout << "Enter Password(hint- dmu): ";
cin >> pas;
}
cout <<setw(33) <<"*WELCOME!*"<< endl;
cout << setw(40) <<"DEBRE MARKOS UNIVERSITY " << endl;
cout << setw(47) <<"COMPUTER LABORATORY MANAGEMENT
STSTEM" <<endl;
cout << divider1 << endl;
do{
cout << "Choose and enter number please. " << endl;
cout << "\t\t1. Teacher" << endl;
cout << "\t\t2. Lab Assistant" << endl;
cout << "\t\t3. Student" << endl;
cout << "\t\t4. Exit" << endl;
cout << "Your choise(1-4)? ";
cin >> profession;
while ((profession < 1) || (profession > 5) )
{
cout << "Please Choose from (1-4): ";
cin >> profession;
}
if(profession == 1)
{
Teacher();
}
else if(profession == 2)
{
Lab_assistant_or_student();
}
else if(profession == 3)
{
cout << "------What would you like to do------" << endl;
cout << "\tA.View Information on computer in IT lab."<< endl;
cout << "\tB.Report a Problem."<< endl;
cout << "Your Choise(A/B):"<< endl;
cin >> subchoise;
if((subchoise == 'A')||(subchoise =='a'))
{
Lab_assistant_or_student();
}
else if((subchoise == 'B')||(subchoise =='b') )
{
Student_Comment();
}
else
{
cout << "Invalid choise.";
}
}
else if(profession == 4)
{
cout << endl;
cout <<setw(50) << "Thank you for your time!"<<endl;
cout << setw(44) <<"Program Exit!";
exit(1);
}
}while(profession == 1 || 2 || 3);
}
}
}
Outputs
Screen 1
Screen 2
Screen 3
Screen 4
Screen 5