0% found this document useful (0 votes)
41 views

Spring 2024 - CS411 - 1

The document provides instructions for an assignment to create an Employee class and Manager class that inherits from Employee in C#. Students are asked to define properties for each class, instantiate a Manager object, set its properties, and print the manager details to the console. The output and code are to be pasted into a Word document and submitted by the due date.

Uploaded by

Nasir waqas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Spring 2024 - CS411 - 1

The document provides instructions for an assignment to create an Employee class and Manager class that inherits from Employee in C#. Students are asked to define properties for each class, instantiate a Manager object, set its properties, and print the manager details to the console. The output and code are to be pasted into a Word document and submitted by the due date.

Uploaded by

Nasir waqas
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

CS411 – Visual Programming

Total Marks: 20
Assignment No. 01
Semester: Spring 2024 Due Date: 29-April-2024

Instructions:

Please read the following instructions carefully before submitting assignment:

You need to use MS word document to prepare and submit the assignment on VU-LMS.

It should be clear that your assignment will not get any credit if:

 The assignment is submitted after due date.


 The assignment is not in the required format (doc or docx).
 The submitted assignment does not open or file is corrupt.
 Assignment is copied (partial or full) from any source (websites, forums, students,
etc)

Objectives:

The objective of this assignment is to enhance the learning capabilities of the students about:

 Introduction to Programming Language C#


 Inheritance
 Properties

If you have any confusion, you can send your query at [email protected]

Lectures Covered: 1 to 12

1
CS411 – Visual Programming
Total Marks: 20
Assignment No. 01
Semester: Spring 2024 Due Date: 29-April-2024

Problem Statement:

Imagine you're tasked with building a program in C# using Visual Studio. First, you need to define an
`Employee` class. Each employee should have a `Name` and `Salary` property.

Next, you're asked to create a more specialized class called `Manager`, which should be inherited
from the `Employee` class. Manager has additional properties: `Id` and `Designation`.

Now, it's time to put your classes into action. You need to define a `Program` class and in its `Main`
method, instantiate a `Manager` class’s object. Set all the properties for this manager instance. Once
you've set the properties, print out the details of the manager object to the console.

Note: Utilize C# language’s features for creating properties with getters and setters to define the
properties of both the `Employee` and `Manager` classes.

Instructions:
 In the Name property of Employee class, you will write your own name.
 In the Id property of Manager class, you will write the numeric part of your VU I’d like 1234567.
 If you didn’t use your own name and id, you will get zero marks.
 Paste the screen shot of output at top of solution in word document, then paste code of program.
(Solution Template is given on page No 3 of this file)

2
CS411 – Visual Programming
Total Marks: 20
Assignment No. 01
Semester: Spring 2024 Due Date: 29-April-2024

Sample Output:

//Put screenshot of output here

//Put your code here

using System;

3
CS411 – Visual Programming
Total Marks: 20
Assignment No. 01
Semester: Spring 2024 Due Date: 29-April-2024

// Define the Employee class


class Employee
{
// Properties
public string Name { get; set; }
public double Salary { get; set; }
}

// Define the Manager class inherited from Employee


class Manager : Employee
{
// Additional properties
public int Id { get; set; }
public string Designation { get; set; }
}

class Program
{
static void Main(string[] args)
{
// Instantiate a Manager object
Manager manager = new Manager();

// Set properties for the manager instance


manager.Name = "Nasir Ilyas";
manager.Salary = 70000;
manager.Id = 200417909;
manager.Designation = "Operational Manager";

// Print out the details of the manager object


Console.WriteLine("Manager Details:");
Console.WriteLine("\nName: " + manager.Name);
Console.WriteLine("\nSalary: " + manager.Salary);
Console.WriteLine("\nID: " + manager.Id);

4
CS411 – Visual Programming
Total Marks: 20
Assignment No. 01
Semester: Spring 2024 Due Date: 29-April-2024

Console.WriteLine("\nDesignation: " + manager.Designation + "\n");

}
}

You might also like