Question: Please us the use of class, object, properties, constructor, and methods in C# programming language in Visual Studio Console App ( no top level statements
Please us the use of class, object, properties, constructor, and methods in C# programming
language in Visual Studio Console App no top level statements:
Create a class Employee in the project. Rename "Program.cs to "EmployeeDriver.cs in the
solution explorer.
In Employee class, add following functionality.
a Add two autoimplemented properties for Id long and name string of the employee.
b Add an instance variable for salary and property with get and set accessor. In the set
accessor if the salary is negative then leave the instance variable unchanged.
c Add two constructors noargs constructor and parametrized constructor. Assign
default values to the properties using noargs constructor. Enclose both constructors in the
named region "Constructors" for organizing code. Region directive in c#
d Override ToString method to create a string representation of the current state of the
object. Use StringBuilder class.
In the main method of the EmployeeDriver class
a Create an object of Employee class using noargs constructor and name it employee
Set id name, and salary values of your choosing for employee object. Print the current state of
the object on the console window. Update the name of the first employee object and then print
the updated state of the object.
b Create another object using parameterized constructor and name it employee Print the
current state of the object on the console window. Update the salary of the second employee
object. Print the updated state of the object on the console window.
Documentation of the code written by you using XML comments, single line comments.
Expected Output
Original Employee information
Employee Id is name is Garry, and salary is $
Updated Employee information
Employee Id is name is Larry, and salary is $
Original Employee information
Employee Id is name is John, and salary is $
Updated Employee information
Employee Id is name is John, and salary is $
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
