-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.java
67 lines (50 loc) · 1.88 KB
/
Employee.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Write a description of class Employee here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Employee {
// instance variables
int id;
String name;
double salary;
// define the no-arg constructor here
// (Set name to "-----", id to 0, salary to 0)
// define the constructor with arguments here
// define the toString method here
// define the equals method here
// define the compareTo method here
// (compare by their names, use the String's compareTo method
// to compare just the names of both employees)
// then at the bottom of main write a conditional that uses it
// DON'T FORGET TO ADD 'implements Comparable<Employee>' TO CLASS SIGNATURE
/**
*
* @param args
*/
public static void main(String[] args) {
Employee undefined = new Employee();
Employee boss = new Employee("Sax Winderhaven", 12345, 55000);
Employee newGuy = new Employee("Jasper John", 44444, 41000);
Employee undefined2 = new Employee();
System.out.print("Employee undefined = ");
printEmployee(undefined);
System.out.print("Employee boss = ");
printEmployee(boss);
System.out.print("Employee newGuy = ");
printEmployee(newGuy);
if (sameEmployee(boss, newGuy)) {
System.out.println("boss and newGuy contain the same info");
}
if (sameEmployee(undefined, undefined2)) {
System.out.println("boss and newGuy contain the same info");
}
// write a conditional expression to determine which employee,
// boss or newGuy comes first in the directory
// if ( )
// System.out.println("newGuy comes first in the directory");
// else
// System.out.println("boss comes first in the directory");
}
}