using System;
public class HealthPlus {
int _patientNumber;
string _name;
string _adress;
string _mobileNumber;
int _day;
int _month;
int _year;
//constructor to initalize all the variables
public HealthPlus (int PatientNumber, string Name, string Adress, string MobileNumber, int Day, int Month, int Year) {
this._patientNumber = PatientNumber;
this._name = Name;
this._adress = Adress;
this._mobileNumber = MobileNumber;
this._day = Day;
this._month = Month;
this._year = Year;
}
public int PatientNumber {
get {
return _patientNumber;
}
set {
this._patientNumber = value;
}
}
public void DisplayPatientNumber() {
Console.WriteLine("Employee Number: {0}", PatientNumber);
}
public string Name {
get {
return _name;
}
set {
this._name = value;
}
}
public void DisplayName() {
Console.WriteLine("Name: {0}", Name);
}
public string Adress {
get {
return _adress;
}
set {
this._adress = value;
}
}
public void DisplayAdress() {
Console.WriteLine("Adress: {0}", Adress);
}
public string MobileNumber {
get {
return _mobileNumber;
}
set {
this._mobileNumber = value;
}
}
public void DisplayMobileNumber() {
Console.WriteLine("Contact Number: {0}", MobileNumber);
}
public int Day
{
get
{
return _day;
}
set
{
this._day = value;
}
}
public void DisplayDay()
{
Console.WriteLine("day: {0}", Day);
}
public int Month
{
get
{
return _month;
}
set
{
this._month = value;
}
}
public void DisplayMonth()
{
Console.WriteLine("month: {0}", Month);
}
public int Year
{
get
{
return _year;
}
set
{
this._year = value;
}
}
public void DisplayYear()
{
Console.WriteLine("year: {0}", Year);
}
}
class HealthPlusTest {
public static void Main(string[] args) {
Console.Write("This is for outdoor patients: \n");
HealthPlus outdoor_patient = new HealthPlus(0, null, null, null, 0, 0, 0);
Console.Write("Enter patient number: ");
outdoor_patient.PatientNumber = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter Name: ");
outdoor_patient.Name = Convert.ToString(Console.ReadLine());
Console.Write("Enter Adress: ");
outdoor_patient.Adress = Convert.ToString(Console.ReadLine());
Console.Write("Enter Mobile Number: ");
outdoor_patient.MobileNumber = Convert.ToString(Console.ReadLine());
Console.Write("Enter a day for admission date: ");
outdoor_patient.Day = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter a month for admission date: ");
outdoor_patient.Month = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter a year for admission date: ");
outdoor_patient.Year = Convert.ToInt32(Console.ReadLine());
outdoor_patient.DisplayPatientNumber();
outdoor_patient.DisplayName();
outdoor_patient.DisplayAdress();
outdoor_patient.DisplayMobileNumber();
outdoor_patient.DisplayDay();
outdoor_patient.DisplayMonth();
outdoor_patient.DisplayYear();
Console.Write("This is for indoor patients: \n");
HealthPlus indoor_patient = new HealthPlus(0, null, null, null, 0, 0, 0);
Console.Write("Enter patient number: ");
indoor_patient.PatientNumber = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter Name: ");
indoor_patient.Name = Convert.ToString(Console.ReadLine());
Console.Write("Enter Adress: ");
indoor_patient.Adress = Convert.ToString(Console.ReadLine());
Console.Write("Enter Mobile Number: ");
indoor_patient.MobileNumber = Convert.ToString(Console.ReadLine());
Console.Write("Enter a day for admission date: ");
indoor_patient.Day = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter a month for admission date: ");
indoor_patient.Month = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter a year for admission date: ");
indoor_patient.Year = Convert.ToInt32(Console.ReadLine());
indoor_patient.DisplayPatientNumber();
indoor_patient.DisplayName();
indoor_patient.DisplayAdress();
indoor_patient.DisplayMobileNumber();
indoor_patient.DisplayDay();
indoor_patient.DisplayMonth();
indoor_patient.DisplayYear();
}
}
![](/image?k=21e42f1afbe426a0bd1d0f8d8a399a38)
Comments
Leave a comment