Question: Fix this code to make it calculate the effeciency of tasks performed per hour import java.util.Scanner; public class Robot { public static void main (

Fix this code to make it calculate the effeciency of tasks performed per hour import java.util.Scanner;
public class Robot {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int totalTasks =0;
String[] robotNames = new String[3];
int[] tasksPerHour = new int[3];
for (int i =0; i <3; i++){
System.out.println("Enter details for Robot "+(i +1)+":");
System.out.print("Robot Identification: ");
robotNames[i]= input.nextLine();
System.out.print("Number of Tasks Performed per Hour: ");
tasksPerHour[i]= input.nextInt();
input.nextLine(); // consume newline left-over
}
input.close();
System.out.println("------------------------------------");
System.out.println("Robot Details:");
for (int i =0; i <3; i++){
System.out.println("Robot "+(i +1)+"- ID: "+ robotNames[i]+", Tasks per Hour: "+ tasksPerHour[i]);
}
double efficiency = totalTasks /3.0;
System.out.println("Overall Efficiency: "+ efficiency +" tasks per robot");
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!