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
Type 1 hypervisors are common in data centers and in cloud computing.<br><br> A. True<br> B. False
Annette [7]

Answer: a

Explanation: just cause

6 0
3 years ago
Your company wants to secure the new data center physically. The company has hired a security guard but wants to find a way so t
goblinko [34]

Answer:

The correct answer to the following question will be Option C (Entry control roster).

Explanation:

A roster for entry controls includes a list of identities and descriptions of people that are going to access. A guard might have a list of recognized staff approved to connect a network channel capability or region.

  • Someone who tries to enter the region will indeed be reviewed, and then they will be refused access unless their identity isn't even on the list.
  • Once people visit, they'll need to display the credentials of the security officer that allows everyone to access the server farm.

So, it's the right answer.

8 0
3 years ago
Choose the expression that belongs in the blank in order to ask the user the question shown.
Rudik [331]

Answer:

"Juan"

Explanation:

If this is script, than that should be the correct argument.

6 0
2 years ago
What are the advantages and drawbacks of using solar energy
Ray Of Light [21]

upfront price, but dependent on how long you use it you will save money, also the power it provides per square inch is low but that will be solved with time.

5 0
3 years ago
On a piano, each key has a frequency, and each subsequent key (black or white) is a known amount higher. Ex: The A key above mid
lora16 [44]

Answer:

sample output

Enter f0 = 440

440.0,466.1637615180899, 493.8833012561241,

523.2511306011974,  554.3652619537443

Explanation:

import math                                 // math library  

def RaiseToPower():                 //  RaiseToPower method

 r = math.pow(2,1/12)               //r = 2^(1/12)

f0 = float(input('Enter f0 : '))     //input from user

                                               

//a key has a frequency,sy f0

                                                                                                                                     

print(f0,end=' ')                      //Display statement

 for n in range(1,5):                //Iterate the loop up to  the next 4 higher key Hz

n = f0 * math.pow(r,n)         //calculate the fn value

print(fn,end=' ')                   //Display statement

 RaiseToPower()                //Call RaiseToPower method  

                                         

 

         

     

       

7 0
4 years ago
Other questions:
  • What are two key benefits of using software tools for graphic design?
    9·1 answer
  • Using the flowchart below, what value when entered for Y will generate a mathematical error and prevent our flowchart from being
    14·1 answer
  • How do you clear space in your iCloud?
    14·1 answer
  • Chat messages are most likely to be found where on a computer? firewall nic internet history ram
    7·1 answer
  • ____ is an integrated system that collects and processes data and manages and coordinates resources, information, and functions
    14·1 answer
  • A _____ object is the instance of a class that receives a request from another object. Select one: a. client b. server c. contra
    5·1 answer
  • What is the missing line?
    7·1 answer
  • Which of the following statements best illustrates how value was created for eggs? when a farmer sells a chicken who is no longe
    9·1 answer
  • What kind is a utility file that shrinks the size of a file
    14·1 answer
  • (09 MC)How can understanding your own personality improve your relationships with others?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!