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
what should the timing of transition slides be per minute? maintain the flow of the presentation to ______ slides per minute.
murzikaleks [220]

Answer:

1-2

Explanation:

It depends on the amount of information that you have on each slide. You want to make sure you're not going too fast but also make sure you arent taking up to much time. Be sure to speak clearly it will make the presentation better by looking clean and time organized. hope this helps :)

8 0
3 years ago
Where do you find the instructions, learning objectives, evaluation and scoring for this aba assignment?.
sp2606 [1]

The instructions, learning objectives, evaluation and scoring for Aba assignment can be found on Preamble of the Applied Behavior Analysis (ABA) assignment.

<h3>What is ABA?</h3>

Applied Behavior Analysis refers to a therapy that is based on the science of learning and behavior.

Hence, the instructions, learning objectives, evaluation and scoring for Aba assignment can be found on Preamble of the Applied Behavior Analysis (ABA) assignment.

Read more about ABA

<em>brainly.com/question/11449763</em>

6 0
2 years ago
Social media allows businesses to use which proven marketing principle? Select one: a. Reciprocity b. Social proof c. Authority
riadik2000 [5.3K]

B is the most reasonable one

3 0
3 years ago
Read 2 more answers
Code in Python
KIM [24]

You're setting the value of user_num to 20. Doing this won't allow the other test cases to run. Simply delete that line and your code should work. This is the code I wrote:

user_num = int(input())

while user_num>=1:

   user_num/=2

   print(user_num)

I wrote my code in python 3.8. I hope this helps.

4 0
2 years ago
What classification term is used to describe games made with huge development
Ludmilka [50]

Explanation:

yhddhhdhsudhenndjeieoeknenejej

8 0
2 years ago
Other questions:
  • Universal Containers are using Salesforce for Order Management and has integrated with an in-house ERP system for order fulfilme
    5·1 answer
  • Which type of password would be considered secure?
    15·1 answer
  • Write an application that asks a user to type an even number or the sentinel value 999 to stop. When the user types an even numb
    8·2 answers
  • When configuring services, what linux directory typically contains server configuration files?
    8·1 answer
  • Which of the following common software packages would help a business
    6·1 answer
  • What is BINARY it is making get confused
    10·1 answer
  • Should you ever force a CPU into<br>its socket?​
    15·1 answer
  • Cuántos tipos de grua existen en el mundo​
    7·1 answer
  • What can be used to help diagnose and fix network connection problems?
    8·1 answer
  • What is the purpose of the ISOWEEKNUM function? determines how many workdays are in a certain week determines how many workdays
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!