Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
Hi I just started learning java and am having a lot of trouble with loop statements.I need a code that I can calculate the average pace of my runs.
Hi I just started learning java and am having a lot of trouble with loop statements.I need a code that I can calculate the average pace of my runs. I am trying to use the while statement for the code since it is required. When i try to run it, it doesnt let me put in 'timeinminutes'. it stays stuck in the input for miles.. How do I fix this? I have researched loop statements and moving things around but suck at piecing it together. Now i cant even get it to run because it says I have an error with ";" please help :(
import static java.lang.System.*;
import java.util.Scanner;
import java.util.*;
class averagepace {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the miles:");
double miles = 0;
double timeinminutes = 0;
double avgpage = 0
while (score != -1) {
time += avgpace;
avgpage= scan.nextDouble();
num++;
}
num--;
System.out.println("The avgpace is:" + (timeinminutes/miles));
}
}