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
Access data is _______ in a Word document.
Naya [18.7K]
I believe the answer is embedded. but make sure to check multiple sources.
5 0
3 years ago
Define generation of computer ​
steposvetlana [31]

Answer:

The generation of computer is define as the devlopment in computer hardware/software,their processing speed and their language.

I HOPE IT HELP YOU

5 0
2 years ago
NEED HELP(10 POINTS) PLEASE HELP MATH
DiKsa [7]
78 ft. hope it helped
6 0
3 years ago
Read 2 more answers
Which of the following statements about programmed decisions is FALSE? a. Programmed decisions deal with repetitive situations.
MA_775_DIABLO [31]

Answer:

Option e: The use of programmed decisions should be limited to noncritical situations.

Explanation:

A repetitive decision or routine that can be managed by developed business  procedures or rules are known as programmed decisions. These kind of decisions are most often known for at certain points in a standard process, and are planned relying on recognized and easily identifiable terms. Programmed decisions generally do not demand much consideration or discussion, and can typically be automated to make certain consistency and save time for decision-makers.

So, the use of programmed decisions should not be limited to noncritical situations.

5 0
3 years ago
______ cards contain a chip that can store a large amount of information as well as on a magnetic. ______ cards contain a chip t
yuradex [85]

Answer:

A. Smart card

Explanation:

Smart cards contain a chip that can store a large amount of information as well as on a magnetic stripe for backward compatibility.

Smart card are cards made of plastic or metal material that has an embedded integrated chip that acts as a security token. Smart cards are the same size as a debit or credit card.

They connect to a reader either by a chip (microcontroller or an embedded memory chip) or through a short-range wireless connectivity standard such as radio-frequency identification or near-field communication.

It can be used to perform various functions though most commonly are used for credit cards and other payment cards.

3 0
3 years ago
Other questions:
  • When a chart is selected, numerous customization options can be found on which Chart Tools tabs?
    11·2 answers
  • Suppose Alice, Bob, and Carol want to use secret key technology to authenticate each other. If they all used the same secret key
    10·1 answer
  • What is the generic term for a mode or method of malware infection?
    8·1 answer
  • Programmers refer to programs that contain meaningful names as ____. AnswerThe answer is: Programmers refer to programs that con
    12·1 answer
  • Evaluate the expression. Be sure to list a value of appropriate type (e.g., 7.0 rather than 7 for a double, Strings in quotes).
    7·1 answer
  • When you start a new blank document, you begin typing at the
    6·1 answer
  • For each problem listed below, use the drop-down menu to select the field of the professional who can help solve the issue.
    7·2 answers
  • What is game development​
    10·2 answers
  • 1. What are the main uses for Protein in the body?
    13·2 answers
  • 1- Identify the face expressions is considered....
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!