Address Book

So I am not really good at object programming can someone show me how this assignment should be put together in code?
Thanks
LinAppleSoft has asked you to create a simple address book application which will collect teachers and student information. Using what you've learned about class architecture, inheritance, and polymorphism, create an app that does the following:

1. Keeps a list of contacts, 10 maximum.

2. Declare and define a SchoolContact class with the following properties and behavior:

string firstName
string lastName
string id

void getInformation()
Used to print all contact information to the screen.

3. Declare and define a Student class which inherits all variables and functions from SchoolContact, but also include the following

string major;
string classesAttended[10];
An array of 10 classes IDs

void addClass(string)
a method to add a class to classesAttended

4. Declare and define a Teacher class which inherits all variables and functions from SchoolContact, but also includes the following

string yearStarted;
string classesTaught[10];
An array of 10 classes IDs

void addClass(string)
a method to add a class to classesTaught

5. Teacher and Student should overload the SchoolContact::getInformation() function to output their respective contact information.

6. Ask the user the following question:

Would you like to add a [S]tudent or a [T]eacher, [L]ist all contacts, [Q]uit.
If a T is input, get the necessary teacher information, loop back and ask again.
If a S is input, get the necessary student information, loop back and ask again.
If a L is input, list out all current contacts in the Address Book, loop back and ask again.
If a Q is input, quit the app

Example contact output:

Teacher
ID: 820111
First name: James
Last name: Dalby
Start Year: 2010
Classes: CS5, CS115

Student
ID: 949302
First name: Emily
Last name: Bronte
Major: Computer Science
Classes: ENG10, ART10, CS5



Here's a starter. Good Luck!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class SchoolContacts {
protected:
string firstName;
string lastName;
string id;
public:
virtual void getInformation();//Used to print all contact information to the screen.
}
class Student: protected SchoolContacts {
protected:
string major;
string classesAttended[10];//An array of 10 classes IDs
public:
void addClass(string);//a method to add a class to classesAttended
void getInformation();
}
class Teacher: protected SchoolContacts{
protected:
string yearStarted;
string classesTaught[10];//An array of 10 classes IDs
public:
void getInformation();
void addClass(string);//a method to add a class to classesTaught
}


In the main use a switch statement for #6.
Last edited on
Topic archived. No new replies allowed.