Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

Define epistemology.

Answered: 1 week ago