Air Jordan wrote:
For those who have experience with object-oriented programming, what's the best way to store these?
Wut? Here is a skeleton (C#). Without more info about what the data looks like, what functions you need to accomplish I can't say much else. What are you going to use the hashmaps for? Do you mean like a basic hash table?
I don't know what the assignment is supposed to do... I can't comment on your "approaches".
Code:
namespace scheduling
{
// if this is a base class, you might change it to protected (I think).
// because in this case, you won't ever have a "person" object that isn't
// a teacher or a student.
public class Person
{
private string _FirstName;
private string _LastName;
// Other common "person" attributes, address, phone, etc.
// Create your public get and set functions
public string FirstName
{
get { return _FirstName;}
set { _FirstName = value;}
}
// Constructor
// functions
}
public class Teacher : Person
{
private string _Department;
private string _EmployeeID; //guid? int? whatever it is use the appropriate datatype
private int _YearsOfService;
// Ditto
}
public class Student : Person
{
private string _Major;
private string _Minor;
private string _StudentID;
// Ditto
}
}