C 1MAIN OBJECTIVE The goal of this project is to design an

*** C++ ***

1.MAIN OBJECTIVE

The goal of this project is to design and implement a university administration system.

The system consists of classes of these types:

Person (Student, Teacher)

Student (B.Sc., M.Sc., Ph.D., ...)

Teacher (lecturer, adjunct, professor, ...),

Course.

Department.

You can have additional classes if required.

2. DESCRIPTION

The system should have these relationships included:

A Person should have the basic information of a person like: university ID, name, birth date, and gender.

A student can be an undergraduate or graduate student.

A student can enroll in a course.

A graduate student can be a teaching assistant or research assistant.

A teaching assistant can be assigned to a course.

A teacher can be a lecturer, adjunct or professor.

A teacher can be assigned to a course.

Courses can be from undergraduate or graduate level.

Courses should include the grades of all students enrolled in the class.

Each teacher, student or course is assigned to a department.

3. TEST PROGRAM

The program should be tested using auxiliary files.

T eachers.txt

Students.txt

Courses.txt

Departments.txt

Each file should contain instances of the classes in the project.

The input to the system is obtained by reading these text files.

Each file should include enough instances to completely test the system’s flow of events:

Display information about Teachers

Display information about Students

Display information about Courses

Display information about Departments

Solution

/*
* Person.cpp
*
* Created on: 17-Nov-2016
* Author: kasturi
*/

#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
#define MAX_SIZE 20
class Course
{
private:
   string courseName;
   int courseID;
   float grades[MAX_SIZE][6];
   int numofStudents;
public:
   Course(int id, string name, int numOfStudents, double grade[6])
   {
       courseID = id;
       courseName = name;
       numofStudents = numOfStudents;
   }
   Course(int id, string name)
   {
       courseID = id;
       courseName = name;
   }
   Course()
   {
       numofStudents = 0;
   }
   void addGrades(double grade[6])
   {

       for(int i=0; i<numofStudents; i++)
       {
           for(int j=0; j<6; j++)
           {
               grades[i][j] = grade[i];
           }

       }
   }
   void printCourse()
   {

       cout<<\"Course Name: \"<<courseName<<endl;
       cout<<\"Course ID: \"<<courseID<<endl;
       cout<<endl;
   }
};

class Department
{
private:
string departmentName;
int departmentID;
public:
Department()
   {

   }
Department(string name, int id)
   {
       departmentID = id;
       departmentName = name;
   }
void setName(int name)
{
departmentName = name;
}
string getName()
{
return departmentName;
}
void setDepartmentID(int id)
{
departmentID = id;
}
int getDepartmentID()
{
return departmentID;
}

void printDepartment()
{
   cout<<\"Department Name: \"<<departmentName<<endl;
   cout<<\"Department ID: \"<<departmentID<<endl;
   cout<<endl;
}
};

class Person
{
public:
int universityID;
string name;
char gender;
int DepartmentID;

Person()
{

}
int getUniversityID()
{
return universityID;
}
void setuniversityID(int id)
{
universityID = id;
}
string getName()
{
return name;
}
void setName(int pname)
{
name = pname;
}
char getGender()
{
return gender;
}
void setGender(char g)
{
gender = g;
}
Person(int id, string pname, char g, int deptID)
{
universityID = id;
name = pname;
gender = g;
DepartmentID = deptID;
}


string personData()
{
string value = \"Name: \" + name + \"\ \";
value +=\"ID: \" + to_string(universityID) + \"\ \";
value +=\"Gender: \" + to_string(gender) + \"\ \";
value +=\"Department ID: \" + to_string(DepartmentID) + \"\ \";
return value;
}
};

class Student : public Person
{
public:
   bool isUndergraduate;
int CourseID;
double grades[6];

Student(int uniID, string name, char gender, bool isUnderGraduate, int scourseID, double grade[6], int deptID) : Person(uniID, name, gender, deptID)
   {

   isUndergraduate = isUnderGraduate;
   CourseID = scourseID;
   for(int i=0; i<6; i++)
   {
       grades[i] = grade[i];
   }
   }
void printData()
{
   cout<<Person::personData();
   cout<<\"Student Type: \";
   if(isUndergraduate)
       cout<<\"UnderGraduate\"<<endl;
   else
       cout<<\"Graduate\"<<endl;
   cout<<\"Course ID: \"<<to_string(CourseID)<<endl;
   cout<<\"Grades: \";
   for(int i=0; i<6; i++)
   {
       cout<<to_string(grades[i])<<\" \";
   }
   cout<<endl<<endl;

}
};

class Teacher : public Person
{
public:
   int courseID;
   string type;

   Teacher(int uniID, string name, char gender, int courseid, string Teachingtype, int departmentID): Person(uniID, name, gender, departmentID)
   {
       courseID = courseid;
       type = Teachingtype;
   }
   void printData()
{
       cout<<Person::personData();
       cout<<\"Teaching Type: \"<<type<<endl;
   cout<<\"Course ID: \"<<to_string(courseID)<<endl;
   cout<<endl<<endl;

}
};


int main()
{
   ifstream infile;
   string line;
   Teacher **teachers = new Teacher*[20];
   Student **students = new Student*[20];
   Course **course = new Course*[20];
   Department **department = new Department*[20];
   int Teachcounter = 0;

   infile.open(\"Teachers.txt\");

   while (getline(infile, line))
   {
       string name, type;
       int id, courseID, deptID;
       char g;
       istringstream iss(line);
       if (!(iss >>id>>name>>g>>courseID>>type>>deptID))
       {
           break;
       } // error

       teachers[Teachcounter] = new Teacher(id, name, g, courseID, type, deptID);
       Teachcounter++;
   }
   infile.close();

   infile.open(\"Students.txt\");

   int stuCounter = 0;
   while (getline(infile, line))
   {
       string name, type;
       int id, courseID, deptID;
       char g;
       bool isUG;
       double grades[6];
       istringstream iss(line);
       if (!(iss >>id>>name>>g>>type>>courseID>>grades[0]>>grades[1]>>grades[2]>>grades[3]>>grades[4]>>grades[5]>>deptID))
       {
           break;
       } // error
       if(type == \"UnderGraduate\")
           isUG = true;
       else isUG = false;
       students[stuCounter] = new Student(id, name, g, courseID, isUG, grades, deptID);
       stuCounter++;
   }
   infile.close();

   //courses
   int courseCount = 0;
   infile.open(\"Courses.txt\");
   while (getline(infile, line))
   {
       string name;
       int id;
       istringstream iss(line);
       if (!(iss >>id>>name))
       {
           break;
       } // error

       course[courseCount] = new Course(id, name);
       courseCount++;
   }
   infile.close();

   //Department
   int deptCount = 0;
   infile.open(\"Departments.txt\");

   while (getline(infile, line))
   {
       string name;
       int id;
       istringstream iss(line);
       if (!(iss >>name>>id))
       {
           break;
       } // error

       department[deptCount] = new Department(name, id);
       deptCount++;
   }
   infile.close();
   //Students
   cout<<\"----Students---- \"<<endl<<endl;
   for(int i=0; i<stuCounter; i++)
   {
       students[i]->printData();
   }

   //Teachers
   cout<<\"----Teachers---- \"<<endl<<endl;
   for(int i=0; i<Teachcounter; i++)
   {
       teachers[i]->printData();
   }

   //courses
   cout<<endl<<\"----Courses----\"<<endl<<endl;
   for(int i=0; i<courseCount; i++)
   {
       course[i]->printCourse();
   }
   //Department
   cout<<endl<<\"----Department----\"<<endl<<endl;
   for(int i=0; i<deptCount; i++)
   {
       department[i]->printDepartment();
   }
   return 0;
}

OUTPUT:

----Students----

Name: Henry

ID: 2234

Gender: 77

Department ID: 34223

Student Type: UnderGraduate

Course ID: 1

Grades: 77.000000 78.000000 79.000000 78.000000 81.000000 82.000000

Name: Nina

ID: 2235

Gender: 70

Department ID: 34224

Student Type: UnderGraduate

Course ID: 0

Grades: 77.000000 78.000000 79.000000 78.000000 81.000000 82.000000

Name: Mike

ID: 2236

Gender: 77

Department ID: 34223

Student Type: UnderGraduate

Course ID: 1

Grades: 77.000000 78.000000 79.000000 78.000000 81.000000 85.000000

Name: Mirey

ID: 2237

Gender: 70

Department ID: 34224

Student Type: UnderGraduate

Course ID: 1

Grades: 71.000000 78.000000 72.000000 78.000000 71.000000 85.000000

----Teachers----

Name: Lisa

ID: 1234

Gender: 70

Department ID: 34223

Teaching Type: Professor

Course ID: 4567

Name: Mathew

ID: 1235

Gender: 77

Department ID: 34224

Teaching Type: Adjunct

Course ID: 4567

Name: Phil

ID: 1236

Gender: 77

Department ID: 34223

Teaching Type: Lecturer

Course ID: 4568

----Courses----

Course Name: B.Sc

Course ID: 4567

Course Name: M.Sc

Course ID: 4568

----Department----

Department Name: CSE

Department ID: 34223

Department Name: EEE

Department ID: 34224

*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ
*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ
*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ
*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ
*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ
*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ
*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ
*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ
*** C++ *** 1.MAIN OBJECTIVE The goal of this project is to design and implement a university administration system. The system consists of classes of these typ

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site