Question: Problem: Employee Class Write a class named Employee that has the following properties: Name--The Name property holds the employee's name. IdNumber--The IdNumber property holds the
Problem: Employee Class Write a class named Employee that has the following properties: Name--The Name property holds the employee's name. IdNumber--The IdNumber property holds the employee's ID number. Department--The Department property holds the name of the department in which the employee works. Position--The Position property holds the employee's job title. The class should have the following overloaded constructors: A constructor that accepts the following values as arguments and assigns them to the appropriate properties: employee's name, employee's ID number, department, and position. A constructor that accepts the following values as arguments and assigns them to the appropriate properties: employee's name, employee's ID number, department, and position properties should be assigned an empty string ("") A parameter-less constructor that assigns empty strings ("") to the Name, Department, and Position properties, and 0 to the IdNumber property.
Computer programming language- C# VIsual Basic forms
my code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace Employee_Class { public partial class Form1 : Form { const int number = 3; Employee[] Employeeinfo = new Employee[number];
public Form1() { InitializeComponent(); } class Employee { const int number = 3; Employee[] Employeeinfo = new Employee[number];
public string _Name; public string _IdNumber; public string _Department; public string _Position;
public Employee(string Name, string IdNumber, string Department, string Position) { _Name = Name; _IdNumber = IdNumber; _Department = Department; _Position = Position; }
public string Name { get { return _Name; } set { _Name = value; } }
public string IdNumber {get { return _IdNumber; } set { _IdNumber = value; }}
public string Department{get { return _Department; }set { _Department = value; }}
public string Position{get { return _Position; }set { _Position = value; }} }
private void Form1_Load(object sender, EventArgs e) { Employeeinfo[0] = new Employee("Susan Meyers", "47899", "Accounting", "Vice President"); Employeeinfo[1] = new Employee("Mark Jones", "39119", "IT", "Programmer"); Employeeinfo[2] = new Employee("Joy Rogers", "81774", "Manufacturing", "Enginner"); }
private void showButton_Click(object sender, EventArgs e) { employeeInfoShowLabel.Text = Employeeinfo[0]._Name; }
private void exitButton_Click(object sender, EventArgs e) { this.Close(); } } }
My issue: everything seems correct, but nothing seems to be printing out. I am not sure what I did incorrectly. Is the code correct?
it needs to print like this
Name Id Number Department Position ----------- ---------- ---------- --------- Susan Meyers 47899 Accounting Vice President Mark Jones 39119 IT Programmer Joy Rogers 81774 Manufacturing Engineer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
