第一类如下:
public class employeeApp
{
public static void main()
{
EmployeeProgram.employee Employee = new EmployeeProgram.employee( );
}
public void employee(int employeeNumber, string name, string dateOfHire, int monthlySalary)
{
employeeNumber = 123;
name = Cody;
dateOfHire = 01/01/11;
monthlySalary = 2500;
}
}
第二类如下:
/*
* Mosbrucker_C_PRO_01 Author: Mosbrucker, Cody
* Creates a class for employee with data members;
* Employee number, name, date of hire, and monthly salary.
* ****************************************************/
public class employee
{
private int employeeNumber;
private string name;
private string dateOfHire;
private int monthlySalary;
public int EmployeeNumber
{
get
{
return employeeNumber;
}
set
{
employeeNumber = value;
}
}
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
public string DateOfHire
{
get
{
return dateOfHire;
}
set
{
dateOfHire = value;
}
}
public int MonthlySalary
{
get
{
return monthlySalary;
}
set
{
monthlySalary = value;
}
}
public override string ToString()
{
return "Employee Id: " + employeeNumber +
"Employee Name: " + name +
"Employee Date of Hire: " + dateOfHire +
"Employee Monthly Salary: " + monthlySalary;
}
}
我遇到的问题是:*在我的employeeApp 类中“不包含适合入口点的“静态”主方法”*在我的employeeApp 类中“名称Cody 在当前上下文中不存在*在我与dateOfHire 相关的employeeApp 类中“不能将 int 隐式转换为字符串
我正在为一个班级和它的任务做这个:创建一个员工班级。作为数据成员包括的项目是员工编号、姓名、雇用日期和月薪。包括适当的构造函数和属性。重写 ToString ( ) 方法以返回所有数据成员。创建第二个类来测试您的 Employee 类。
非常感谢任何帮助。