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 auto-implemented 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 - no-args constructor and parametrized constructor. Assign
default values to the properties using no-args 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 no-args constructor and name it employee1.
Set id, name, and salary values of your choosing for employee1 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 employee2. 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 1 information
Employee Id is 1, name is Garry, and salary is $90,000.00
Updated Employee 1 information
Employee Id is 1, name is Larry, and salary is $90,000.00
Original Employee 2 information
Employee Id is 2, name is John, and salary is $70,000.00
Updated Employee 2 information
Employee Id is 2, name is John, and salary is $100,000.00
 Please us the use of class, object, properties, constructor, and methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!