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
tekilochka [14]
3 years ago
5

Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). O

riginal main():
int main() {
double milesPerHour;
double minutesTraveled;
double hoursTraveled;
double milesTraveled;

cin >> milesPerHour;
cin >> minutesTraveled;

hoursTraveled = minutesTraveled / 60.0;
milesTraveled = hoursTraveled * milesPerHour;
cout << "Miles: " << milesTraveled << endl; return 0;
}
#include
using namespace std;
//please write your answer here.
int main() {
double milesPerHour;
double minutesTraveled;

cin >> milesPerHour;
cin >> minutesTraveled;

cout << "Miles: " << MphAndMinutesToMiles(milesPerHour, minutesTraveled) << endl;
return 0;
}
Computers and Technology
1 answer:
babymother [125]3 years ago
6 0

Answer:

The program to this question can be given as:

Program:

#include <iostream> //header file

using namespace std; //using namespace

double MphAndMinutesToMiles(double milesPerHour, double minutesTraveled) //defining method

{

return (minutesTraveled/ 60.0)*milesPerHour; //return value.

}

int main() //defining main method

{

double milesPerHour,minutesTraveled; //define variable

cout<<"Enter miles per hour :";  

cin >> milesPerHour;  

cout<<"Enter travelling minutes :";

cin >> minutesTraveled;

cout << "Miles: "<< MphAndMinutesToMiles(milesPerHour, minutesTraveled)<< endl;

return 0;

}

Output:

Enter miles per hour :12

Enter travelling minutes :20

Miles: 4

Explanation:

The explanation of the above C++ program can be given as:

  • In the first header file is include the function is define that is "MphAndMinutesToMiles". This function accepts two parameters that are "milesPerHour and minutesTraveled".
  • Both parameter datatype is double and the function return type is also double. Inside a function calculate miles and return its value.
  • In the main method, two variable defines that takes value from the user side and pass into the function. To print function return value we use "cout" function that prints function return value.
You might be interested in
What is a premium?
Dominik [7]
B- the amount you pay the health insurance company every month for coverage
4 0
4 years ago
Read 2 more answers
Read the scenario below. Explain why this is not fair use of copyright materials. What should you do instead of using the entire
Thepotemich [5.8K]

Answer:

You did not buy the rights to the copyrighted material when you bought it from Apple Music

Explanation:

When you bought the song from Apple Music, you paid them for your using of the song to listen to, as stated in the agreement that you wouldve been required to agree to. Apple is only allowed to provide the material for personal use to its users, with it part of its fees going to the original copyright holders.

8 0
4 years ago
Dropbox is an example of ________. Bluetooth technology optical storage SSD technology cloud storage
inessss [21]

IaaS

Laas is Framework as a help are online administrations that give significant level APIs used to dereference different low-level subtleties of basic organization foundation like actual registering assets, area, information dividing, scaling, security, reinforcement and so forth

7 0
3 years ago
What option would fit the most content on a page?
zvonat [6]

Answer:

normal margins will fit the most content on a page

7 0
2 years ago
Suppose a linked list of 20 nodes. The middle node has a data –250. Write the pseudocode to replace the middle node of the linke
dexar [7]

Answer:

The middle node has a data –250. ... Write The Pseudocode To Replace The Middle Node Of The Linked List With ... Assume That The List's Head Pointer Is Called Head_ptr And The Data For The New Node Is Called Entry ... Assume that the list's head pointer is called head_ptr and the data for the new node is called entry ...

Explanation:

4 0
4 years ago
Read 2 more answers
Other questions:
  • Point mode allows you to select cells for use in a formula by using your finger or the pointer
    7·1 answer
  • Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000
    15·1 answer
  • You're the network administrator for a company that has just expanded from one floor to two floors of a large building, and the
    13·1 answer
  • The small company where you work needs to implement a second server for its accounting system, but does not have the funds to pu
    11·1 answer
  • B) Use an Excel function to find: Note: No need to use Excel TABLES to answer these questions! 6. The average viewer rating of a
    10·1 answer
  • The frame header at the Data Link layer includes hardware addresses of the source and destination NICs. What is another name for
    11·1 answer
  • Items that represent features of smartphones apps
    12·1 answer
  • Which benefit does the cloud provide to star-up companies without access to large funding?
    11·1 answer
  • how to make windows laptop work faster because I mine is so slowwwww. I already updated it and everything and tried everything b
    9·1 answer
  • What’s unique about New Cashierless stores?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!