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
Nonamiya [84]
3 years ago
14

Write a method so that the main() code below can be replaced by the simpler code that calls method mphandminutestomiles(). origi

nal main():
Computers and Technology
2 answers:
aliya0001 [1]3 years ago
6 0
Create the function as a double. Put both your variables to call inside the () of the created function. Then create a variable to hold the answer. 

double MphAndMinutesToMiles(double milesPerHour, double minutesTraveled){ double miles;  miles = (minutesTraveled / 60) * milesPerHour;  return miles;}
lara [203]3 years ago
5 0

The simpler code for the given main ( ) function is shown below. For this, calculate the hours and miles before the main function and store them in the separate variables and after this, use these variables in main ( ) code. The below complete code is written in Java which  reduce the given main ( ) code and also make it simple.

Further Explaination:

The simple code in Java to calculate the miles traveled is shown below:

Code: Simple.java

import java.util.Scanner;

public class CalcMiles

{

//Define the method calcMilesTraveled().

Public double calcMilesTraveled (double mph, double minutesTravelled)

{

//Declare required variables.

Double hoursTravelled = 0.0;

Double milesTravelled = 0.0;

//Calculate the hours travelled and miles travelled.

hoursTravelled = minutesTravelled / 60.0;

milesTravelled = hoursTravelled * mph;

//The total miles travelled in return.

Return milesTravelled;

}

public static void main(String [] args)

{

double milesPerHour = 70.0;

double minsTravelled = 100.0;

CalcMiles tripCalculator = new CalcMiles();

System.out.println("Miles: " + tripCalculator.calcMilesTraveled (milesPerHour, minsTraveled));

}

}

Output:

Run the program, the output will be look like as below:

Miles: 116.66666666666667

Learn more:

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. How does coding work on computers?  brainly.com/question/2257971  

Answer details:

Grade: College Engineering

Subject: Computer Science and Engineering

Chapter: Java Programming

Keyword:

Java, input, output, programming, statements,  class, double, int, miles, hours, milesPerHour, hoursTraveled, printf, return

You might be interested in
what is true about the depth of the troposphere? group of answer choices it varies with passing air masses. it is shallower in s
miss Akunina [59]

All of them are true. The depth of the troposphere is highly variable, as it is affected by the <em>passing air masses</em>, <em>the </em><em>temperature</em>, <em>and the </em><em>latitude</em><em> of the location. </em>

<h3>What is true about the depth of the troposphere? </h3>

<u>All of bellow are </u><u>true</u><u>:</u>

  • <em>It varies with passing air masses.</em>
  • <em>It is shallower in summer. </em>
  • <em>It is deeper over the cooler poles. </em>
  • <em>It is shallower over the warm tropics. </em>
  • <em>It is deeper in winter.</em>

<u>The </u><u>depth</u><u> of the </u><u>troposphere</u> is highly variable and dependent on <em>several factors</em>, <em>including passing air masses</em>, <em>temperature</em>, and latitude. For instance, in <u>summer</u>, it is typically shallower due to higher temperatures, whereas in winter, it is deeper as temperatures drop. Over cooler regions near the poles, the depth is also deeper, whereas over the warmer tropics, the depth is shallower.

All of these factors contribute to the changing depth of the troposphere, making it a dynamic and ever-changing part of the atmosphere.

Learn more about Troposphere: brainly.com/question/25526298

#SPJ4

8 0
1 year ago
What does l m a o actually mean?
vladimir2022 [97]

Answer:

L-Laughing m-my a-a*s o-off

Explanation:

8 0
3 years ago
When Python is running in the interactive mode and displaying the chevron prompt (&gt;&gt;&gt;) - what question is Python asking
Montano1993 [528]

Answer:

Python is asking: What Python statement would you like me to run?                          

Explanation:

When you start python, it displays a start up message along with >>>  sign which is called chevron. The chevron is a prompt which indicates that the interpreter is waiting for you to type a statement or an expression.

The chevron prompt is used by the interpreter which means that the interpreter is ready. Then you can type an expression or statement and it gives response accordingly by evaluating that expression.

6 0
3 years ago
Which activity is performed during high-level design in the V-model?
SVETLANKA909090 [29]

Answer:

understanding component interaction

4 0
3 years ago
Taking into account recent technological developments, what technical advances do you think are possible in the next twenty year
stiv31 [10]

Nuclear Fusion reactors may reach the prototype commercial stage , The causes and possible treatment of Alzheimers Disease  and Partial cloning of human organs for transplant therapy

Explanation:

Fusion may be an energy technology that seems to be perpetually coming over the horizon, but projects around the world such as SPARC are getting increasingly close to reactors that, although smaller in capacity, can produce net positive power in just a few years. To help accelerate discovery of permanent cure for Alzheimers, an alliance of pharmaceutical companies, nonprofit foundations and government advisers, has developed a partnership to share data from Alzheimer's clinical trials. This would definitely pave way for the permanent cure for Alzheimer. The most common method of therapeutic and reproductive cloning is somatic cell nuclear transfer (SCNT). SCNT involves separating the nucleus from a donor egg, and replacing it with the DNA from the organism meant to be cloned. Scientists could potentially clone organs with SCNT by cloning embryos, extracting the stem cells from the blastocyst, and stimulating the stem cells to differentiate into the desired organ. these three scientific and technological advancements are possible.

8 0
3 years ago
Other questions:
  • Write a program to read in a two values row and col to initialize a 2D array using those values. Then create a function FindTran
    15·1 answer
  • The person who Oversee the direct work of employees and is responsible for the day-to-day tasks the employees complete is likely
    7·2 answers
  • The author of the book (El-Haiwan) in which he mentioned many animals True ir False​
    14·2 answers
  • Disk drives have been getting larger. Their capacity is now often given in terabytes (TB) where 1 TBequals1000 gigabytes, or abo
    14·1 answer
  • Which is a common problem for inserting pictures into placeholders?
    10·1 answer
  • A program that doesn’t work properly needs to be debugged. true or false
    8·1 answer
  • Complete the function to return the factorial of the parameter,
    9·2 answers
  • What makes a computer a computer?​
    12·2 answers
  • PLEASE HELP!!!
    8·1 answer
  • Who would win in a fight, Noble 6 from halo reach or Master Chief??
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!