Starting from:

$19.99

Java Program to compare the distinct salaries Solution

Your program is going to compare the distinct salaries of two individuals for the last 5 years. If the salary for the two individual for a particular year is exactly the same, you should print an error and make the user enter both the salaries again for that year. (The condition is that there salaries should not be the exact same).

Your program should accept from the user the salaries for each individual one year at a time.

When the user is finished entering the salaries, the program should print which individual made the highest salary for the last 5 years. This is the individual whose salary is the highest.

You have to use arrays and loops in this assignment.

In the sample output examples, what the user entered is shown in italics. Welcome to the winning card program.

Enter the salary individual 1 got in year 1

10000

Enter the salary individual 2 got in year 1

50000

Enter the salary individual 1 got in year 2

30000

Enter the salary individual 2 got in year 2

50000

Enter the salary individual 1 got in year 3

35000

Enter the salary individual 2 got in year 3

105000

Enter the salary individual 1 got in year 4

85000

Enter the salary individual 2 got in year 4

68000

Enter the salary individual 1 got in year 5

75000

Enter the salary individual 2 got in year 5

100000

Individual 2 has the highest salary. 

More products