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
Why do attackers tend to target public or private Wi-fi networks?
Anika [276]

Answer:

The answer to this question is given below in this explanation section.

Explanation:

A free WiFi connection in a public space can seem like a lifesaver when you are on the go.But if you decide to use public WiFi just be aware that you could be making yourself an easy target for hackers and putting your information and more at risk.

one of the dangers of using a public WiFi network is that data over this type of open  connection is often encrypted and  unsecured ,leaving you vulnerable to a man in the middle attack.It when a cyber criminal exploits a security  flaw in the network to intercept data

  • Avoid connecting to public WiFi connection. i if you must use a public WiFi hotpots also use a virtual privater network to secure your connection.
  • Do not  log in to password protected websites that contains sensitive information when using a public WiFi connection for example banking and social networking sites or even email.
  • Keep your software patched and up to date and all your devices even your mobiles ones to avoid any potential infection by viruses or malware if you do use unsecured public WiFi.

5 0
3 years ago
How do i know when someone answered my questions and where can i check what they wrote?
maksim [4K]

Answer:

U can go to your profile, then go to your question to see what they have written.

Explanation: Hope this helps

3 0
3 years ago
IT professionals recognize that successful systems must be user-oriented, and users need to be involved, formally or informally,
elixir [45]

Answer: True

Explanation:

System development is the process in which a system is developed,planned, designed,tested, modified etc. Analysis of design,internal structure and external factors is done for implementation to creation of system.

  • An IT professional is responsible for performing various tasks in system development.He/she has to analyze and detect that the developed system is convenient for user.
  • Involvement of user also plays an important part in system development through various ways such as improvement in system, smooth implementation,innovation,enhancing quality etc.
  • So, user can be involved in official or unofficial manner for betterment of system development.
  • Thus, the given statement is true.
3 0
3 years ago
What is the answer for 2.8.10 word games? This is what I have so far, but I can’t seem to be able to figure out the bananaSplit
Feliz [49]

Answer:

 public String bananaSplit(int insertIdx, String insertText) {

     return word.substring(0, insertIdx) + insertText + word.substring(insertIdx);

 }

Explanation:

Do you have the other parts of the WordGames class?

8 0
2 years ago
You are implementing a RAID storage system and have found a system with eight 100 GB drives. How much storage space will you hav
asambeis [7]

Answer:

The space available will vary between 800 GB (100%) and 400 GB (50%) of the total disks, depending on the RAID level.

The OS will handle the RAID as a single disk.

Explanation:

Each RAID level implements parity and redundancy in a different way, so the amount of disks used for this extra information will reduce the space available for actual storage.

Usual RAID levels are:

<u>RAID 0:</u> does not implement any redundancy or parity, so you will have available 100% of the total storage: 8 x 100 GB = 800 GB

<u>RAID 1:</u> Duplicates all the information in one disk to a second disk. Space is reduced in half: 400 GB

<u>RAID 5:</u> Uses the equivalent of 1 disk of parity data distributed evenly on each disk, meaning the space available is \frac{n-1}{n} of the total disks: \frac{7}{8} of 800 GB = 700 GB

Writting and reading the information on a RAID storage is handled by a raid controller, either implemented in hardware or software. The OS will "see" a single disk and will read or write information as usual.

4 0
3 years ago
Other questions:
  • True or false? You can test your marketing emails in different email clients from within the email editor.
    10·1 answer
  • Cuales Son las características de la máquina analítica de Carlos Babbage ?
    11·1 answer
  • Which computer device is used to capture or copy a photograph to place in a report?
    14·1 answer
  • Which speaker port should you use when connecting a single speaker to a pc?
    6·1 answer
  • laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. She adds pictures of t
    11·1 answer
  • If you want to write some fancy interface on your computer with expanded communication to the Arduino, what library should you u
    13·1 answer
  • How is counting in this circle and square system similar to how we count in our regular lives? How is it different?
    15·1 answer
  • To rotate text in a cell select the option in the alignment grouping
    9·2 answers
  • Who play fortnite gameeeeeeee
    14·1 answer
  • Are programs that understand physics and/or hardware embedded? for example, one that uses finite-element methods to predict flui
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!