Hi , Welcome to KK's Home Page ......
 

My Software Engineering Home Page : Assignment#3

Problem: Implementing a class hierarchy using C#

Fig 1.
Implementation in C#

Person.cs

using System;
{
class Person
{
private String name;
private String dob;

public Person(String aname, Stringadob)
{
name = aname;
dob = adob;
}

public String getName() { return name;}
public String getDOB() { return dob;}
}
}

DoctorPerson.cs

using System;
{
class DoctorPerson
{
private string dateEmployed;
private string specialty;

public DoctorPerson( String date, String special)
{
dataEmployed = date;
specialty = special;
}

public String getDateEmployed () { return dateEmployed;}
public String getSpecialty () { return specialty;}
}
}

PatientPerson.cs

using System;
{
class PatientPerson
{
private string employer;
private string insuranceCo;
private Treatment records [ ];
private int numRecords;

public PatientPerson( String boss, String insure, int num)
{
employer = boss;
insuranceCo = insure;
records = new Treatment [num];
numRecords = num;
}

public String getEmployer () { return employer;}
public String getInsureCo () { return insuranceCo;}
public Treatment [ ] getAllTreatments() { return records;}
}
}

Treatment.cs

using System;
{
class Treatment
{
private string date;
private int startTime;
private int endTime;

public Treatment( String adate, int sTime, int eTime)
{
date = adate;
startTime = sTime;
endTime = eTime;
}

public String getTreatmentDate () { return date;}
public int getStartTime () { return startTime;}
public int getEndTime () { return endTime;}
}
}