0% found this document useful (0 votes)
10 views2 pages

MC160402261 CS411

The document describes an assignment to create a class hierarchy for an employee and manager. It defines an Employee class with name and salary properties and getter and setter methods. It defines a Manager class that inherits from Employee and adds an ID and designation property with getter and setter methods. It creates a Manager object, sets the properties, and displays the details.

Uploaded by

rhanzla1220
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

MC160402261 CS411

The document describes an assignment to create a class hierarchy for an employee and manager. It defines an Employee class with name and salary properties and getter and setter methods. It defines a Manager class that inherits from Employee and adds an ID and designation property with getter and setter methods. It creates a Manager object, sets the properties, and displays the details.

Uploaded by

rhanzla1220
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CS 411

Assignment # 01
Student ID: MC160402261
Solution:
Screenshot:

Code:
using System;

class Employee
{
public string Name = "";
public double Salary = 0.0;

public void setName(string name)


{ Name = name; }

public void setSalary(double salary)


{ Salary = salary; }

public string getName()


{ return Name; }

public double getSalary()


{ return Salary; }
}

class Manager : Employee


{
public int Id = 0;
public string Designation = "";

public void setId(int id)


{ Id = id; }

public int getID()


{ return Id; }

public void setDesignation(string designation)


{ Designation = designation; }

public string getDesignation()


{ return Designation; }
}

class Program
{
static void Main()
{
Manager manager = new Manager();
manager.setName("Amir Javed");
manager.setSalary(90000.00);
manager.setId(160402261);
manager.setDesignation("Junior Manager");

Console.WriteLine("Manager Details:");
Console.WriteLine("Name: " + manager.getName());
Console.WriteLine("Salary: " + manager.getSalary() + "/-");
Console.WriteLine("ID: " + manager.getID());
Console.WriteLine("Designation: " + manager.getDesignation());
Console.ReadLine();
}
}

You might also like