Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CreateNewDepartment ComputerScience Science-2 0 CreateNewDepartment Education Science-1 0 CreateNewDepartment Business Craven-Hall 0 CreateNewDepartment Engineering Machray-Hall 0 CreateNewDepartment Biology Science2 110 ListDepartments CreateNewFaculty John_Smith jsmith@csusm.edu 99_Broadway_Street

CreateNewDepartment ComputerScience Science-2 0

CreateNewDepartment Education Science-1 0

CreateNewDepartment Business Craven-Hall 0

CreateNewDepartment Engineering Machray-Hall 0

CreateNewDepartment Biology Science2 110

ListDepartments

CreateNewFaculty John_Smith jsmith@csusm.edu 99_Broadway_Street 10/19/1960

Male 60000 5 100

CreateNewFaculty Bob_Anderson banderson@csusm.edu 130_San_Marcos_Avenue 09/21/1958

Male 70000 8 100

CreateNewFaculty Sue_Clark sclark@csusm.edu 113_Santa_Fe_Road 02/05/1970

Female 50000 2 100

CreateNewFaculty Abu_Talib atalib@csusm.edu 311_Twin_Oaks_Road 03/03/1970

Male 55000 5 101

CreateNewFaculty Nancy_Bank nbank@csusm.edu 300_El_Camino_Real 04/07/1975

Female 59000 6 101

CreateNewFaculty Susan_Brown sbrown@csusm.edu 123_Winner_Avenue 07/14/1976

Female 62000 4 101

CreateNewFaculty Ahmad_Saleh asaleh@csusm.edu 211_Mirmar_Ave 12/12/1968

Male 75000 12 102

CreateNewFaculty Beth_Card bcard@csusm.edu 111_Land_Road 11/15/1971

Female 63000 7 102

CreateNewFaculty Joe_Abraham jabraham@csusm.edu 100_Star_Street 02/01/1959

Male 82000 14 102

CreateNewFaculty Andy_Chan achan@csusm.edu 777_Plant_Avenue 12/07/1950

Male 93000 24 130

ListFaculties

ListFacultiesInDepartment 100

ListFacultiesInDepartment 101

ListFacultiesInDepartment 102

ListFacultiesInDepartment 130

CreateNewStudent Kathy_Chen kchen001@csusm.edu 999_Morning_Street 01/02/1982

Female 1 ComputerScience 600

CreateNewStudent Kelly_Wong kwong001@csusm.edu 999_Palace_Avenue 02/12/1980

Male 2 ComputerScience 600

CreateNewStudent Layla_Esmail lesmail001@csusm.edu 999_Perry_Cresesnt 11/12/1980

Female 2 ComputerScience 910

ListStudents

ListStudentsOfAFaculty 600

ListStudentsOfAFaculty 650

CreateNewCourse CS111 100 600 60

CreateNewCourse CS211 100 600 60

CreateNewCourse CS311 100 0 30

CreateNewCourse Ed100 101 603 45

CreateNewCourse Ed200 101 603 45

CreateNewCourse Ed300 101 0 30

CreateNewCourse Bus101 102 606 40

CreateNewCourse Bus102 102 606 40

CreateNewCourse Bus103 102 607 40

CreateNewCourse Bio103 102 706 40

ListCourses

ListCoursesTaughtByFaculty 606

ListCoursesTaughtByFaculty 706

ListCoursesOfADepartment 100

ListCoursesOfADepartment 101

ListCoursesOfADepartment 102

ListCoursesOfADepartment 130

AddACourseForAStudent 200 500

AddACourseForAStudent 201 500

AddACourseForAStudent 202 500

AddACourseForAStudent 230 500

ListCoursesTakenByStudent 500

ListCoursesTakenByStudent 520

ListCoursesTakenByStudent 500

AssignDepartmentChair 600 100

AssignDepartmentChair 610 101

AssignDepartmentChair 601 110

AssignInstructorToCourse 600 202

ListCoursesTaughtByFaculty 600

Write a program that implements a small university. The university has the following components: Department, Student, Faculty, and Course. The property of each component is outlined as follows:

Department:

id (long)

name (string)

location (string)

chairId (long)

nextDepartId (static long) // Initialize to 100

Course:

CRN (long)

maxAvaliableSeats (integer)

name (string)

departId (long)

assignedSeats (long)

isTaughtBy (long)

nextCRN (static long) // initialize it to 200

Student:

id (long)

name (string)

email (string)

address (string)

dateOfBirth (string)

gender (string)

yearOfStudy (integer)

major (string)

advisorId (long)

coursesTaken (vector of courses taken by a student)

nextStId (static long) // initialize it to 500

Faculty:

id (long)

name (string)

email (string)

address (string)

dateOfBirth (string)

gender (string)

salary (float)

yearOfExp (intger)

departId (long)

nextFacultyId (static long) // initialize it to 600

Each of the above components becomes a class of its own. You can provide set() and get() functions in order to assign values or retrieve the values of the attributes. Further, each class should have constant print method that simply prints the values of the attributes on the screen.

The pseudo code for the University class is provided. Print that and use that class in your program.

Your main program is written for you. It calls a method in the University class to read a transaction file and process its commands. The transaction file contains several commands and values. The commands and their formats are:

CreateNewDepartment depName depLoc depChairId

RemoveADepartment depId

CreateNewStudent Name Email Address DateOfBirth

Gender YearOfStudy Major AdvisorId

RemoveAStudent StId

CreateNewCourse Name DepId TaughtBy MaxSeat

RemoveACourse CRN

CreateNewFaculty Name Email Address DateOfBirth

Gender Salary YearOfExp DepId

RemoveAFaculty FactId

ListCoursesTaughtByFaculty facultyId

ListCoursesTakenByStudent studentId

ListFacultiesInDepartment departId

ListStudentsOfAFaculty facultyId

ListCoursesOfADepartment departId

AddACourseForAStudent courseId stId

DropACourseForAStudent courseId stId

AssignDepartmentChair facultyId departId

AssignInstructorToCourse facultyId courseId

ListDepartments

ListStudents

ListCourses

ListFaculties

As you see there are 17 different commands. Some commands come with other parameters. For example, if your program detects the command CreateNewDepartment, you should expect three values associated with depName, depLoc, and depChairId. Similary if your program detects the command CreateNewFaculty, you should expect 8 values associated with this command: Name, Email, Address, DateOfBirth, Gender, Salary, YearOfExp, and DepId.

Do the following:

Run your program against the provided transaction file

Make sure to break up your classes into .cpp and .h files

All of your classes must have at least one constructor

There is a lot of common attributes between faculty and students, create a new super class (parent class) to place the common attributes in there and make the Student class and Faculty class to inherit the attributes of that super class

STUB FOR A3

< All the red sections are optional. You can implement it only if you have time>

#include

#include

#include

using namespace std;

class University

{

protected:

vector Departments;

vector Students;

vector Courses;

vector Faculties;

static bool failure;

static bool success;

public:

University();

~University();

bool CreateNewDepartment(string depName, string depLoc, long depChairId);

bool RemoveADepartment(long depId);

bool CreateNewStudent(string sName, string sEmail, string sAddress, string sDateOfBirth, string sGender,

int sYearOfStudy, string sMajor, long sAdvisorId);

bool RemoveAStudent(long sStId);

bool CreateNewCourse(string cName, long cDepId, long cTaughtBy, int cMaxSeat);

bool RemoveACourse(long cCRN); // Optional

bool CreateNewFaculty(string fName, string fEmail, string fAddress, string fDateOfBirth, string fGender,

float fSalary, int fYearOfExp, long fDepId);

bool RemoveAFaculty(long fFactId);

bool ListCoursesTaughtByFaculty(long facultyId);

bool ListCoursesTakenByStudent(long studentId);

bool ListFacultiesInDepartment (long departId);

bool ListStudentsOfAFaculty(long facultyId);

bool ListCoursesOfADepartment(long departId);

bool AddACourseForAStudent(long courseId, long stId);

bool DropACourseForAStudent(long courseId, long stId);

bool AssignDepartmentChair(long facultyId, long departId);

bool AssignInstructorToCourse (long facultyId, long courseId);

bool ListDepartments();

bool ListStudents();

bool ListCourses();

bool ListFaculties();

bool ProcessTransactionFile(string fileName);

};

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

bool University::failure = false;

bool University::success = true;

//----------------------------------------------------------------------------

University::University()

{

}

//----------------------------------------------------------------------------

University::~University()

{

}

//----------------------------------------------------------------------------

bool University::CreateNewDepartment(string depName, string depLoc, long depChairId)

{

/*

- If the depChairId is 0, it means the chair is not known yet; otherwise, you need

to check if the depChairId passed to this method is a valid existing faculty.

print appropriate message and return failure if the chair is not valid

- create an object of department that calls appropriate constructor to assign

these values

- the value of id should be assigned to the value of nextDepartId

- Make sure to increment the value of nextDepartId by 1 in the constructor

- insert the new object to the Departments vector

- return success

*/

}

//----------------------------------------------------------------------------

bool University::RemoveADepartment(long depId)

{

/*

- check if the depId passed to this method is a valid existing department id. If not

return failure; otherwise,

- search and remove the department from the Departments vector only if the department has no faculty

and offers no course and no student's major matches the department name

- return success

*/

}

//----------------------------------------------------------------------------

bool University::CreateNewStudent(string sName, string sEmail, string sAddress, string sDateOfBirth, string sGender,

int sYearOfStudy, string sMajor, long sAdvisorId)

{

/*

- If the sMajor is 0, it means the student has not chosen a major; otherwise, you need

to check if the sMajor passed to this method is a valid existing department name.

print appropriate message and return failure if this is not the case

- If the sAdvisorId is 0, it means the student has not chosen an advisor or does not need

an advisor; otherwise, you need to check if the sAdvisorId passed to this method

is a valid existing faculty id. Print appropriate message and return failure if this is not the case

- create an object of student that calls appropriate constructor to assign

these values

- the value of id should be assigned to the value of nextSttId

- Make sure to increment the value of nextStId by 1 in the constructor

- insert the new object to the Students vector

- return success

- Note: The vector CourseTaken should be initially empty. You can use the appropriate methods

shown in the University class to add or drop a course for a student later

*/

}

//----------------------------------------------------------------------------

bool University::RemoveAStudent(long sStId)

{

/*

- check if the sStId passed to this method is a valid existing student id. If not

return failure; otherwise,

- search and remove the student from the Students vector

- make sure that before removing the student, you need to call the drop course method to drop his/her

courses

- return success

*/

}

//----------------------------------------------------------------------------

bool University::CreateNewCourse(string cName, long cDepId, long cTaughtBy, int cMaxSeat)

{

/*

- If the cTaughtBy is 0, it means no one is assigned to teach this course.

otherwise, you need to check if the cTaughtBy passed to this method is a

valid existing faculty. Print appropriate message and return failure if

this is not the case

- you need to check if the cDepId passed to this method is a valid existing department.

Print appropriate message and return failure if this is not the case

- create an object of Course that calls appropriate constructor to assign these values

- the value of assigned seats should be assigned to zero in the constructor

- the value of CRN should be assigned to the value of nextCRN

- Make sure to increment the value of nextCRN by 1 in the constructor

- insert the new object to the Courses vector

- return success

*/

}

//----------------------------------------------------------------------------

bool University::RemoveACourse(long cCRN)

{

/*

- check if the cCRN passed to this method is a valid existing course id. If not

return failure; otherwise,

- search and remove the course from the Courses vector only if no student is currently taking

this course

- return success

*/

}

//----------------------------------------------------------------------------

bool University::CreateNewFaculty(string fName, string fEmail, string fAddress, string fDateOfBirth, string fGender,

float fSalary, int fYearOfExp, long fDepId)

{

/*

- you need to check if the fDeptId passed to this method is a valid existing department.

Print appropriate message and return failure if this is not the case

- create an object of Faculty that calls appropriate constructor to assign these values

- the value of faculty id should be assigned to the value of nextFacultyId

- Make sure to increment the value of nextFacultyId by 1 in the constructor

- insert the new object to the Faculties vector

- return success

*/

}

//----------------------------------------------------------------------------

bool University::RemoveAFaculty(long fFactId)

{

/*

- check if the fFactId passed to this method is a valid existing faculty id. If not

return failure; otherwise,

- search and remove the faculty from the Faculties vector only if this faculty is not

teaching a course nor advising any student, nor chairing any department

- return success

*/

}

//----------------------------------------------------------------------------

bool University::ListCoursesTaughtByFaculty(long facultyId)

{

/*

- This routine should list all the courses (courseId and CourseName)

that are currently being taught by a particular faculty

- make sure that the facultyId passed to this method is a valid existing

faculty id. If this is not the case print appropriate message and return failure;

otherwise, return success

*/

}

//----------------------------------------------------------------------------

bool University::ListCoursesTakenByStudent(long studentId)

{

/*

- This routine lists all the courses (courseId and CourseName)

that currently taken by a particular student

- make sure that the studentId passed to this method is a valid existing

student id. If this is not the case print appropriate message and return failure;

otherwise, return success

*/

}

//----------------------------------------------------------------------------

bool University::ListFacultiesInDepartment (long departId)

{

/*

- This routine lists all the faculties (facultyId, facultyName) in a particular

department

- make sure that the departId passed to this method is a valid existing

department id. If this is not the case print appropriate message and return failure;

otherwise, return success

*/

}

//----------------------------------------------------------------------------

bool University::ListStudentsOfAFaculty(long facultyId)

{

/*

- This routine lists all the students (studentId and studentName) of a particular

faculty

- make sure that the facultyId passed to this method is a valid existing

faculty id. If this is not the case print appropriate message and return failure; otherwise,

return success

*/

}

//----------------------------------------------------------------------------

bool University::ListCoursesOfADepartment(long departId)

{

/*

- This routine lists all the courses offered by a particular department

- make sure that the departId passed to this method is a valid existing

department id. If this is not the case print appropriate message and return failure; otherwise,

return success

*/

}

//----------------------------------------------------------------------------

bool University::AddACourseForAStudent(long courseId, long stId)

{

/*

- This routine adds a course for a student

- When you add a course for a student, you need to ensure that there is enough seat in that class

Increment the number of assigned seats if you could enroll the student for this course

- make sure that the courseId and stId passed to this method are both valid

If this is not the case print appropriate message and return failure; otherwise,

return success

*/

}

//----------------------------------------------------------------------------

bool University::DropACourseForAStudent(long courseId, long stId)

{

/*

- This routine drops a course for a student

- When you drop a course for a student, you need to decrement the number of assigned

seats for that course

- make sure that the courseId and stId passed to this method are both valid

If this is not the case print appropriate message and return failure; otherwise,

return success

*/

}

//----------------------------------------------------------------------------

bool University::AssignDepartmentChair(long facultyId, long departId)

{

/*

- This routine assigns a chair to a department

- make sure that the facultyId and departId passed to this method are both valid

If this is not the case print appropriate message and return failure; otherwise,

return success

*/

}

//----------------------------------------------------------------------------

bool University::AssignInstructorToCourse (long facultyId, long courseId)

{

/*

- This routine assigns a course to an instructor to teach

- make sure that the courseId and facultyId passed to this method are both valid.

If this is not the case print appropriate message and return failure; otherwise,

return success

*/

}

//----------------------------------------------------------------------------

bool University::ListDepartments()

{

/*

- This method should list the department id's and department names only

*/

}

//----------------------------------------------------------------------------

bool University::ListStudents()

{

/*

- This method should list the student id's and student names only

*/

}

//----------------------------------------------------------------------------

bool University::ListCourses()

{

/*

- This method should list the course id's and course names only

*/

}

//----------------------------------------------------------------------------

bool University::ListFaculties()

{

/*

- This method should list the faculty id's and faculty names only

*/

}

//----------------------------------------------------------------------------

bool University::ProcessTransactionFile (string fileName)

{

/*

- open the transaction file and process it one by one

- If the file could not be opened, print appropriate message and return failure;

otherwise, return success

*/

}

//----------------------------------------------------------------------------

int main()

{

University csusm;

csusm.ProcessTransactionFile("TransactionFile.txt");

}

//----------------------------------------------------------------------------

TRANSACTION FILE:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

2. Why?

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago