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, 22.06.2019 20:00
What statement best describes operating systems? it’s possible for modern computers to function without operating systems. most operating systems are free or very inexpensive. operating systems are managed by the computer’s microprocessor (cpu). operating systems manage the computer’s random access memory (ram).
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
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.02.2021 21:20
question
Mathematics, 02.02.2021 21:20
question
Mathematics, 02.02.2021 21:20
question
Mathematics, 02.02.2021 21:20
question
History, 02.02.2021 21:20
Questions on the website: 13722361