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
After you select your recipients, the next step in using the Mail Merge Wizard would be to _____.
NARA [144]

Answer:

Write your letter

Explanation:

When using a Mail Merge Wizard in a Microsoft Word Document, this is the process.

  • Click on your document type
  • Click on the starting document
  • Select the recipient(s)
  • Write your letter and add some custom fields
  • Insert your address Block
  • Strike enter and click on Greeting line (to enter a greeting)
  • Preview your letter and click on complete merge
3 0
3 years ago
Read 2 more answers
Andrew received a text file with data from a company he works with. He would like to have all of the data in his database. Andre
Lelu [443]
Upgrade his database and transfer a screenshot of it to a word doc.
6 0
3 years ago
Read 2 more answers
Finish the program to compute how many gallons of paint are needed to cover the given square feet of walls. Assume 1 gallon can
Zepler [3.9K]

Answer:

The program in Python is:

Area = float(input("Area: "))

print("Gallons: "+str(Area/350.0))

Explanation:

The requirement of the program is straightforward and what is required is to divide the inputted area by 350.

Hence, the explanation is as follows:

This line prompts user for Area

Area = float(input("Area: "))

This line calculates and prints the equivalent number of gallons

print("Gallons: "+str(Area/350.0))

4 0
3 years ago
Question 4 (5 points) If your social media accounts are___________, college admissions representatives can look at your social m
noname [10]

If your social media accounts are public, college admissions representatives can look at your social media activity when deciding whether or not to accept you at their school.

<h3>What is a public social media account?</h3>

Public social media account is also known as the open account, in which any people can check the person's post and like and share the post. Basically, famous people like to keep their account public to gain more publicity.

Thus, option D is correct.

For more details about Public social media account, click here:

brainly.com/question/23378133

#SPJ1

8 0
2 years ago
Telecommunications and software development are examples of information technology careers.
9966 [12]

Answer:

True

Explanation:

Information technology may be described as the use of systems to aid application designs capable of sending and receiving information and building a communication pathway for individuals and companies. It also involves retrieving, storing large chunks of information and organizational data usually in databases to fast track the seamless functioning of the organization's system. The information technology ecosystem is very broad from those charged with ensuring effective communication such as telecommunications platforms and those who build and develop technologies for effective communication and data storage. Hence, both Telecommunications and software development are examples of information technology careers.

5 0
3 years ago
Other questions:
  • A _________ is the broadcast of various types of media over the web.
    10·2 answers
  • When you copy text, the selected text is copied from the original location and placed on the
    9·1 answer
  • Researching the history of computers is a good troubleshooting technique.<br> True or False?
    5·1 answer
  • How do I copy and paste equations and pictures like math graphs, to post on this site to help get my questions answered?
    13·2 answers
  • Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, if
    13·1 answer
  • Give a recursive version of the algorithm Insertion-Sort (refer to page 18 in the textbook) that works as follows: To sort A[1..
    12·1 answer
  • Part 1 of 4 parts for this set of problems: Given an 4777 byte IP datagram (including IP header and IP data, no options) which i
    9·1 answer
  • Setting up a desktop computer for anAutoCADspecialist who needs a minimum of 125 GBram which operating system would be the best
    5·1 answer
  • The most significant concerns for implementation of computer technology involve _______, security, and ethics. accuracy property
    10·1 answer
  • A system is being developed to help pet owners locate lost pets. Which of the following best describes a system that uses crowds
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!