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
How did the invention of the printing press affect society?
MrMuchimi

Answer:

A. More people could influence the media of that time

Explanation:

Its immediate effect was that it spread information quickly and accurately. This helped create a wider literate reading public. However, its importance lay not just in how it spread information and opinions, but also in what sorts of information and opinions it was spreading.

8 0
2 years ago
In an input file, what maintains the location of the next item that will be read from the file?
Semmy [17]

The Read Position marks the location of the next item that will be read from the file.

6 0
4 years ago
What does limited access to a document mean?
Licemer1 [7]
The second last one is the answer i think
7 0
4 years ago
Read 2 more answers
Instead of delivering songs that you are likely enjoy services such as offers you a bility to play practically song that you wan
s344n2d4d5 [400]
Use Amazon music you can play any song you want
7 0
3 years ago
Select the correct text in the passage.
sergejj [24]

Answer:

2. Scientists use seismometers to measure the earthquake activity that occurs beneath a volcano. They then predict the eruption of that volcano.

Explanation:

The options are:

1. Before a volcano erupts, earthquake activity beneath the volcano decreases.2. Scientists use seismometers to measure the earthquake activity that occurs beneath a volcano. They then predict the eruption of that volcano.3. When a volcano erupts, the amount of carbon dioxide and sulfur dioxide emitted decreases. 4.Scientists measure the amount of these gases to determine the amount of magma present in the volcanic reservoir.

The answer is certainly 2. as seismometers are being used to find out the details of the earthquake activities which occur inside a volcano. And with this information, the volcanologists then predict the eruption of that particular volcano. Hence, the 2nd option does not have any factual errors, and all the others have factual errors.

5 0
3 years ago
Other questions:
  • Whats the 7 internal components found in a computer tower
    11·1 answer
  • Gary lives in an area that receives high rainfall throughout the year. Which device would be useful to him to maintain his compu
    10·2 answers
  • Suppose that a program performs an intermixed sequence of (stack) push and pop operations. The push operations put the integers
    9·1 answer
  • Write the following method to display three numbers in increaseing order:
    5·1 answer
  • Which command should you enter to configure a single port to discard inferior bpdus 200-125?
    5·1 answer
  • On the Excel Ribbon, click the Data tab in the Sort &amp; Filter Group, and then click the Sort button to conduct a _____ sort.
    8·1 answer
  • Your organization's network has multiple layers of security devices. When you attempt to connect to a service on the Internet. H
    9·1 answer
  • How does the author of let bindi have the limelight persuade readers to consider the importance of wildlife conservation
    9·2 answers
  • You have recently subscribed to an online data analytics magazine. You really enjoyed an article and want to share it in the dis
    9·1 answer
  • IF YOU LOVE GOD HELP ME......What should be covered in the conclusion of a presentation?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!