Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A) Using CodeBlocks or your IDE of choice, create the files main.cpp, Person.h, and Person.cpp. Make sure that the files are all added to the

A) Using CodeBlocks or your IDE of choice, create the files main.cpp, Person.h, and Person.cpp. Make sure that the files are all added to the same project (main.cpp should be created when you first create a new project) so that the linker will link them together for us.

B) Cut and paste the starter files into your appropriate project files for the application, interface, and implementation.

C) Create three new Classes using inheritance. At least one should be a child of Person and at least one should be a grandchild of Person. Example: You could create Employee (child of Person), Student (child of Person), and GradStudent (child of Student, making it a grandchild of Person). Alternatively you could create Student (child of Person), GradStudent (child of Student, making it a grandchild of Person ), and UndergradStudent (child of Student, making it a grandchild of Person).

D) Each of your new classes must add at least one new private or protected data element (some new information this object stores), at least one mutator for giving this data a value, and at least one accessor for returning this value. Make sure your operations make sense in the context of the class you have designed. Example: Student is a person with a number of credit hours (int num_credits), so we need an accessor to return num_credits and we need a mutator to either set the number of credits or add a number of credits. GradStudent is a Student who can graduate with at least 30 credit hours (bool can_graduate). UndergradStduent is a Student who can graduate with at least 120 credit hours (bool can_graduate). Example: can_graduate shouldn't just be set true or false based upon a boolean argument but instead should be updated when the credit hours exceed the threshold.

E) Each of your new classes should have 2 constructors: A Default constructor and one which takes arguments for both its new data and all of Person's data. You can either make Person's data protected or else use the space after : to call Person's constructors.

F) Update the main function to demonstrate your new classes and their accessors / mutators. Test both the new functions you created for them and also the functions they inherited such as getName and getBirthdate.

image text in transcribed

File CSC275 Lab7Starter_main.cpp (231 B) #include #include "Person.h" using namespace std; int main { Person tonyal "Tonya", "Wright", 2, 21, 1972), cout

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

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

2. Why has the conflict escalated?

Answered: 1 week ago

Question

1. What might have led to the misinformation?

Answered: 1 week ago