Question
package arreyreview; public class HoursAndPayAngela { public static void main(String[] args) { int [] [] hours = new int [7] [5]; for (int row =
package arreyreview;
public class HoursAndPayAngela {
public static void main(String[] args) {
int [] [] hours = new int [7] [5];
for (int row = 0; row < 7; row++){
for(int col = 0; col < 5; col++){
hours[row][col]= (int) (Math.random()*11);
System.out.print(hours[row][col]+" ");
}
System.out.println();
}
System.out.println();
int [] totalEmp = new int [5];
for (int col = 0; col < 5; col ++){
totalEmp[col] = 0;
for (int row = 0; row < 7; row ++){
totalEmp[col]+=hours[row][col];
}
System.out.println("Total for employee " + col + " is " + totalEmp[col] );
}
System.out.println();
int count = 0;
for(int row = 0; row < 7; row++){
count = 0;
for(int col = 0; col < 5; col ++){
if(hours[row][col]!=0)
count+= 1;
}
System.out.println("On day: " + row + " " + count + " workers worked.");
}
System.out.println();
}
}
a) If each employee was paid $20.5 per hour calculate and output the weekly earnings for each employee.
b) Calculate and output how much all employees earned together.
c) how many employees worked more than 5 hours on Saturday (day with index 6).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started