Answer:
See explanation
Explanation:
From the question, you have answered the question. However, it is poorly formatted.
<em>So, I'll help present the code properly and also give explanation using comments.</em>
import java.util.Scanner;
public class CalcMiles{
//This line defines the calcMilesTraveled method
private static double calcMilesTraveled(double milesPerhour, double minsTraveled){
//This declares hoursTraveled
double hoursTraveled;
//This declares milesTraveled
double milesTraveled;
<em>//This calculates the hoursTraveled</em>
hoursTraveled = minsTraveled/60.0;
//This calculates the milesTraveled
milesTraveled = hoursTraveled * milesPerhour;
//This returns the milesTraveled
return milesTraveled;
}
//The main method begins here
public static void main(String [] args){
//This declares and initializes milesPerhour
double milesPerhour =70.0;
//This declares and initializes minutesTraveled
double minutesTraveled = 100.0;
//This calls the calcMilesTraveled function and also prints the required result
System.out.println("Miles: "+calcMilesTraveled(milesPerhour, minutesTraveled));
}
}
<em>See attachment for program without comments</em>