1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
marta [7]
3 years ago
11

Write a method so that the main() code below can be replaced by simpler code that calls method calcMilesTraveled(). Original mai

n():
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
Computers and Technology
1 answer:
patriot [66]3 years ago
5 0

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>

Download txt
You might be interested in
Dams provide what kind of energy ?
Leto [7]
Water energy to supply anything
6 0
3 years ago
Read 2 more answers
Were is the hype house
balandron [24]

Answer:

LA

Explanation:

where the rich people live

8 0
3 years ago
Read 2 more answers
How many bits must be “flipped” (i.e., changed from 0 to 1 or from 1 to 0) in order to capitalize a lowercase ‘a’ that’s represe
castortr0y [4]
Only one.
00100001 is 'A'
01100001 is 'a'
4 0
3 years ago
Basics AutoCare is a small auto service business with two locations in a Midwest (U.S.) city. The business is based on providing
kogti [31]

Answer:

The ER diagram for the auto service is shown in the attachment.

5 0
3 years ago
1. What does it mean to say that a country’s land area is positively correlated with its population?
disa [49]
For 1.
Positive correlation means if you plot a country's population and land size on a graph. There would be a linear regression line that's sloping upwards. 

Since it's a scatterplot, there will be some that fall out of the line, but most of them should be on the line.

It's  (A)

For 2.
An outlier is a datapoint that's far, FAR away from the others, so it's (B)

For 3. (A), it's a single line-of-best fit that runs through the middle of the cluster of data points.
5 0
3 years ago
Read 2 more answers
Other questions:
  • In Microsoft Word you can access the _______ command from the "Mini toolbar
    11·1 answer
  • What can you do to make sure you have a healthy credit report
    13·2 answers
  • True or false? when intel places a sticker on computers showing their chip is inside, they are demonstrating their visible value
    7·1 answer
  • Jane is debugging a code consisting of 25 lines. The code starts executing at line 11. At line 13, the code calls another method
    10·2 answers
  • Upon looking out at the
    8·2 answers
  • The _________ in Java is passed by value but ______ is passedby reference.
    5·1 answer
  • Write a program "addnumbers.c" where it takes as many arguments as the user includes as command line arguments and calculates th
    11·1 answer
  • Does anyone know the answer for this? I’m extremely confused.
    8·2 answers
  • A good practice when using public domain content is to
    7·1 answer
  • Life without internet points
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!