subject

Write a method so that the main() code below can be replaced by simpler code that calls method calcMilesTraveled(). Original main(): public class CalcMiles {
public static void main(String [] args) {
double milesPerHour = 70.0;
double minutesTraveled = 100.0;
double hoursTraveled;
double milesTraveled;
hoursTraveled = minutesTraveled / 60.0;
milesTraveled = hoursTraveled * milesPerHour;
System. out. println("Miles: " + milesTraveled);
}
}
1 import java. util. Scanner;
2
3 public class CalcMiles (
4
5 /" Your solution goes here ./
6 private double calcMilesTraveled(double milesPertour, double ninsTraveled)
7 double hoursTraveled
8 double milesTraveled;
9
10 hoursTraveled mibsTraveled 60.8
11 milesTraveled hoursTraveled milesperhour
12
13 return milesTraveled;
14
15
16 public static void main(String 0] args)
17 double milesPerhour 70.0;
18 double minutesTraveled 100.0
19
20 System. out. printin("Miles: mphAndMinutesToMiles(milesPerHour, minutesTraveled))i

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
question
Computers and Technology, 25.06.2019 01:00
When a new name is registered on the internet, the process can take two hours to four hours four hours to three days two hours to two days one hour to eight hours
Answers: 1
question
Computers and Technology, 25.06.2019 01:30
Once a vulnerability has been identified by nessus, where would you check for more information regarding the identified vulnerability, exploits, and any risk mitigation solution?
Answers: 1
question
Computers and Technology, 25.06.2019 06:30
How are slides deleted from a presentation?
Answers: 1
You know the right answer?
Write a method so that the main() code below can be replaced by simpler code that calls method calcM...
Questions
question
Mathematics, 02.12.2020 05:40
question
Mathematics, 02.12.2020 05:40
Questions on the website: 13722361