This is a C# console application assignment: Create a class called Employee that
ID: 670729 • Letter: T
Question
This is a C# console application assignment:
Create a class called Employee that includes one piece of information: name of the employee (type string). Do not create any instance variable. Instead, use auto-implemented property. Your class should have a constructor that initializes the name. Write a test application named EmployeeTest that demonstrates class Employee’s capabilities. Ask the user to enter the name for two employees and use them to create two Employee objects Retrieve the names stored in the Employee objects and display them in the console window.
Explanation / Answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EmployeeTest
{
public class Employee
{
public String ename { get; set; }
public Employee(String en)
{
ename = en;
}
}
class Program
{
static void Main(string[] args)
{
Employee o = new Employee("AAA");
Console.WriteLine(o.ename);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.