+ 1
maximum wage, minimum wage and average of all wages
how do i make my program to be able to calculate maximum wage, minimum wage and average of all wages? https://code.sololearn.com/c5h29RCDmM91/?ref=app
9 Réponses
+ 2
You don't. Common way for traversing an array is by using for...loop.
+ 2
I'll be back later, I have to go again now. Please try to make that Employee class, so we can move on later ...
+ 2
Ipang I suggested and wrote class Employee before, you can use it
https://www.sololearn.com/Discuss/2887429/?ref=app
https://www.sololearn.com/Discuss/2888137/?ref=app
+ 2
Zemiak,
Sorry about that, I forget a lot of things. I didn't even check his questions to notice ...
#unsub
+ 2
Ipang
I have already given solution as you explained in 1st reply.
I think it is easy to do that.
Bobby Dike
You can use Java stream API to get min and max wages. I have done both things in my code.
Now to get average you can get sum of all wages using Java Stream and after getting sum divide sum with length of employee list.
Or you can use average method of stream class
https://code.sololearn.com/cfXzaLDTMoCe/?ref=app
+ 2
Yes AJ,
My bad I didn't check he had posted it earlier.
+ 1
I would create an Employee class and fill it with id, name, workHours etc. properties. Then I can create an array (or ArayList) of Employee class to contain the records.
Next I would traverse the array to find the min & max wages, sum the wages and divide the result with number of array's elements to get the average.
0
how do i traverse the array using the if statement
0
okay, how do i write the statement. I've tried but there are too many errors.
its in the program i posted