-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram63.java
More file actions
35 lines (28 loc) · 866 Bytes
/
Copy pathprogram63.java
File metadata and controls
35 lines (28 loc) · 866 Bytes
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
// Find Employee with Highest Salary
class Employee {
String name;
int salary;
Employee(String name, int salary) {
this.name = name;
this.salary = salary;
}
}
public class program63 {
public static void main(String[] args) {
Employee[] employees = {
new Employee("Shalabh", 35000),
new Employee("Rahul", 42000),
new Employee("Aman", 38000),
new Employee("Karan", 50000)
};
Employee highest = employees[0];
for (Employee e : employees) {
if (e.salary > highest.salary) {
highest = e;
}
}
System.out.println("Highest Paid Employee:");
System.out.println("Name: " + highest.name);
System.out.println("Salary: ₹" + highest.salary);
}
}