📄 employeetest.java
字号:
import java.util.*;
class MyDate
{
private int year = 0;
private int month = 0;
private int day = 0;
/**
* Method MyDate
*
*
*/
public MyDate(int y,int m,int d) {
year=y;
month=m;
day=d;
// TODO: Add your code here
}
/**
* Method getYear
*
*
* @return
*
*/
public int getYear() {
return year;
// TODO: Add your code here
}
/**
* Method getMonth
*
*
* @return
*
*/
public int getMonth() {
return month;
// TODO: Add your code here
}
/**
* Method getDay
*
*
* @return
*
*/
public int getDay() {
// TODO: Add your code here
return day;
}
}
class Employee{
private String name;
private double salary;
private MyDate hireDate;
/**
* Method Employee
*
*
*/
public Employee(String n,double s,MyDate d) {
name =n;
salary=s;
hireDate=d;
// TODO: Add your code here
}
// * Method print
// *
// */
public void print() {
System.out.println(name+" "+salary+" "+hireDate.getDay()+" "+hireDate.getMonth()+" "+hireDate.getYear());
// TODO: Add your code here
}
/**
* Method hireYear
*
*
* @return
*
*/
// public int hireYear() {
// return hireDate.getYear();.
// TODO: Add your code here
// }
}
public class EmployeeTest{
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
Employee[] staff=new Employee[3];
staff[0]=new Employee("hacker",3500,new MyDate(1985,6,26));
staff[1]=new Employee("hello",2345,new MyDate(1983,10,3));
staff[2]=new Employee("tiger",4577,new MyDate(1783,12,4));
int i;
System.out.println("the information is:\n");
for(i=0;i<3;i++)
staff[i].print();
// TODO: Add your code here
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -