Define a console application with a class ‘Employee’ with variables as emp_id (int), name (String) and Grade (double).Define five different constructors for this class to initialize the variable values. Define Finalize method to display the Grade value. Define a for loop in Main for 4 iterations and inside for loop create Employee object. After the for loop call Garbage Collector.
1
Expert's answer
2011-05-23T10:09:41-0400
using System;
namespace Employee { class Employee { & // Member variables of the class & private int emp_id; & private string name; & private double grade;
& // The constructors
& // The default constructor & public Employee() & { // Some default values emp_id = 1; grade = 1; name = "Some name"; & }
& // Three different constructors depending on the amount of parameters
Comments
Leave a comment