[Solved]-Using C 11 Goals Implement Program Using Inheritance Polymorphism Get Practice Classes Obj Q37241251
Using C++ 11
Goals
- Implement a program using inheritance and polymorphism
- Get more practice on classes and objects
In this lab, we will write an information system for OregonState University. The purpose of this lab is to help you understandthe basic concepts of inheritance and polymorphism.
Requirements
This program is a simple representation of an Oregon Stateinformation system that contains information about theuniversity.
Below are the requirements for all the classes and therelationship between them.
Important: You may use vectors for thisassignment if you choose so.
Note: For each class, you are required tocreate necessary functions such as constructors, setters,getters, destructors to make the program work.
University Class
The University class contains the following membervariables:
- name: name of the university.
The name of the university MUST be “Oregon State University”
- buildings: contains n number of Buildingobjects
- people: contains m number of Personobjects
It contains the following member functions:
- A function that prints the information on all thebuildings in its information system (name, address, andbuilding’s size)
- A function that prints the information of all thepeople (name, age, GPA or Rating)
Note: The information on Building class andPerson class are described below.
Note: When printing information of all people,you need to distinguish instructors and studentsby print either a “GPA” or “Rating”.
Building Class
The Building class contains the following member variables:
- name: name of the building
- size: the size of the building (in sqft)
- address: address of the building (stored asstring)
You are encouraged to get the actual address and sizes ofbuildings that exist on the actual campus, here is the link to lookthis up, but this is not a hard requirement.
http://facilities.oregonstate.edu/buildings (Links to anexternal site.)Links to an external site.
Note: No additional member function requiredfor this class.
Person Class
Person class is polymorphic, a Person pointercan hold an Instructor/Student object.
The Person class contains the following member variables:
- name: name of the person
- age: age of the person
The age of a person can be randomized or from input, but make itrealistic
The Person class contains the following member function:
A function called “do_work()” that generates a random numberthat represents how many hours they will do work for, and thenoutput message depending on if the Person is a Student or anInstructor.
Note: You can find more information on whatmessage to output below.
Note: You can set a range for the random numberto make the working hours look reasonable.
Student Class
The Student class contains the following member variable:
- GPA, the student’s GPA (double or float datatype)
The range for GPA must be between 0.0 and 4.0.
For “do_work()” in Person class, if the Person is a Student,then the function should output the following message:
“PERSON_NAME did X hours of homework.” Where PERSON_NAME is theperson’s name, and X is the randomly generated number.
Instructor Class
The Instructor class contains the following member variable:
- rating, the instructor’s rating (double orfloat data type)
The range for rating must be between 0.0 and 5.0.
For “do_work()” in Person class, if the Person is an Instructor,then the function should output the following message:
“PERSON_NAME graded papers for X hours.” Where PERSON_NAME isthe person’s name, and X is the randomly generated number.
Menu
The menu must have at least the followingoptions:
- Prints information about all the buildings
- Prints information of everybody at the university
- Choose a person to do work
- Exit the program
If option 3 is selected, the program should printanother menu that prints all the people’s name and let theuser input the choice of the person the user would like, to dowork.
When the program starts, you need to manuallyinstantiate at least 1 student, 1 instructor, and 2buildings inside the University object. It can be done by eitherhard coding that information, or have the user input all theinformation at the start of the program.
You can add more options in the menu such as adding morePerson/Buildings, or create other functions/variables to modularizecode and complete the lab. It is not a hard requirement.
have the following features:
- Save the information to a file
- Read a saved information from a file
- Add people to the program during runtime.
This will allow the user to add more people to the university,and close the program without losing all the information
Student has meaningful variable names, good commenting,organized program structure. No memory leaks.
Classes Created Correctly
University, Building, Person, Student and Instructor Classescreated correctly. Person must be polymorphic and can point toeither a Student or Instructor.
1. Student and Instructor must override Person::do_work 2.University must have Person and Building print info functions.
Menus work correctly including input validation.
Save info to file – Read info from saved file – Add peopleduring runtime
Expert Answer
Answer to Using C++ 11 Goals Implement a program using inheritance and polymorphism Get more practice on classes and objects In th… . . .
OR

