Answer to Question #151732 in C# for Tooba Tariq

Question #151732
HPC handles three types of employees: doctors, paramedical staff and receptionists. The
system needs to record their details; which for all staff includes a four-digit employee number,
their name, address, gender, contact number and qualification. Doctors must be qualified; the
system will store their highest medical qualification, date of degree awarded and their Pakistan
Medical Council registration number. For lab assistant, the system will need to store
experience, and for receptionists, the system will store duty hours.
1
Expert's answer
2020-12-17T15:31:23-0500
using System;
public class recordEmployee {
    int _employeeNumber;
    string _name;
    string _adress;
    string _gender;
    string _contactNumber;
    string _qualification;
    
    //constructor to initalize all the variables
    public recordEmployee (int EmployeeNumber, string Name, string Adress, string Gender, string ContactNumber, string Qualification) {
        this._employeeNumber = EmployeeNumber;
        this._name = Name;
        this._adress = Adress;
        this._gender = Gender;
        this._contactNumber = ContactNumber;
        this._qualification = Qualification;
    }
    public int EmployeeNumber {
        get {
            return _employeeNumber;
        }
        set {
            this._employeeNumber = value;
        }
    }
    public void DisplayEmployeeNumber() {
        Console.WriteLine("Employee Number: {0}", EmployeeNumber);
    }
    
    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 Gender {
        get {
            return _gender;
        }
        set {
            this._gender = value;
        }
    }
    public void DisplayGender() {
        Console.WriteLine("Gender: {0}", Gender);
    }
    
    public string ContactNumber {
        get {
            return _contactNumber;
        }
        set {
            this._contactNumber = value;
        }
    }
    public void DisplayContactNumber() {
        Console.WriteLine("Contact Number: {0}", ContactNumber);
    }
    
    public string Qualification {
        get {
            return _qualification;
        }
        set {
            this._qualification = value;
        }
    }
    public void DisplayQualification() {
        Console.WriteLine("Qualification: {0}", Qualification);
    }
}
class recordEmployeeTest {
    public static void Main(string[] args) {
        Console.Write("This is for doctors: ");
        
        recordEmployee Doctor = new recordEmployee(0, null, null, null, null, null);
        Console.Write("Enter Employee number: ");
        Doctor.EmployeeNumber = Convert.ToInt32(Console.ReadLine());
        Console.Write("Enter Name: ");
        Doctor.Name = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Adress: ");
        Doctor.Adress = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Gender: ");
        Doctor.Gender = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Contact Number: ");
        Doctor.ContactNumber = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Qualification: ");
        Doctor.Qualification = Convert.ToString(Console.ReadLine());
        
        Doctor.DisplayEmployeeNumber();
        Doctor.DisplayName();
        Doctor.DisplayAdress();
        Doctor.DisplayGender();
        Doctor.DisplayContactNumber();
        Doctor.DisplayQualification();
        
        Console.Write("This is for paramedical staff: ");
        
        recordEmployee staff = new recordEmployee(0, null, null, null, null, null);
        Console.Write("Enter Employee number: ");
        staff.EmployeeNumber = Convert.ToInt32(Console.ReadLine());
        Console.Write("Enter Name: ");
        staff.Name = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Adress: ");
        staff.Adress = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Gender: ");
        staff.Gender = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Contact Number: ");
        staff.ContactNumber = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Qualification: ");
        staff.Qualification = Convert.ToString(Console.ReadLine());
        
        staff.DisplayEmployeeNumber();
        staff.DisplayName();
        staff.DisplayAdress();
        staff.DisplayGender();
        staff.DisplayContactNumber();
        staff.DisplayQualification();
        
        Console.Write("This is for reseptionists: ");
        
        recordEmployee reseptionist = new recordEmployee(0, null, null, null, null, null);
        Console.Write("Enter Employee number: ");
        reseptionist.EmployeeNumber = Convert.ToInt32(Console.ReadLine());
        Console.Write("Enter Name: ");
        reseptionist.Name = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Adress: ");
        reseptionist.Adress = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Gender: ");
        reseptionist.Gender = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Contact Number: ");
        reseptionist.ContactNumber = Convert.ToString(Console.ReadLine());
        Console.Write("Enter Qualification: ");
        reseptionist.Qualification = Convert.ToString(Console.ReadLine());
        
        reseptionist.DisplayEmployeeNumber();
        reseptionist.DisplayName();
        reseptionist.DisplayAdress();
        reseptionist.DisplayGender();
        reseptionist.DisplayContactNumber();
        reseptionist.DisplayQualification();
    }
}





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS