5.23 LAB: Miles to track laps

One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps.


Output each floating-point value with two digits after the decimal point, which can be achieved by executing

cout << fixed << setprecision(2); once before all other cout statements.


Ex: If the input is:


1.5

the output is:


6.00

Ex: If the input is:


2.2

the output is:


8.80

Your program must define and call a function:

double MilesToLaps(double userMiles)

has to be done in c++

Answers

Answer 1

Answer:

Following are the code to this question:

#include <iostream>//defining header file

#include <iomanip> //defining header file

using namespace std;

double MilesToLaps(double userMiles)//defining method MilesToLaps which accepts parameter  

{

   double numlaps; //defining double variable

   numlaps = userMiles / 0.25; //calculating and holding numlaps value

   return numlaps; //return value

}

int main() //defining main method

{

   double userMiles;//defining double variable userMiles

   cout<<"Enter miles value: ";//print message

   cin>>userMiles;//input value

   cout<<fixed<<setprecision(2);//using setprecision method

   cout<<"Total laps: "<<MilesToLaps(userMiles);//print MilesToLaps method value

   return 0;

}

Output:

Enter miles value: 1.5

Total laps: 6.00

Explanation:

Description of the above code:

In the above program, a double method "MilesToLaps" is declared, which accepts "userMiles" a double variable in its parameter. Inside the method, a double variable "numlaps" is declared, which divides the "userMiles" value by 0.25 and returns its value. In the main method, a double variable "userMiles" is declared that inputs value from the user end and use the setprecision and call the method "MilesToLaps"  and prints its return value.
Answer 2

Answer:

def miles_to_laps(miles):

  return miles / 0.25

miles = 5.2

num_of_lap = miles_to_laps(miles)

print("%0.2f miles is %0.2f lap(s)" % (miles, num_of_lap))

Explanation:


Related Questions

how to Ctrl + shift + F4 but in a HP laptop?​

Answers

Answer:

Hit the X Button Located on the top right corner or hit Control, Alt, Delete

Explanation:

Hitting the X button will make you exit the whole cite, or hitting Control, Alt, Delet, will make you go to the task bar, in which you can go to the bottom right of that screen and it should say end task

Just hit the X button on the top of the right corner. (I mean you could also just hit control + Alt + Delete)

Which of the following correctly describes the Filter procedure for managing spreadsheet data? Check all that apply.

☞︎Filter allows you to view only the information you want to see.

Filter deletes rows of data you do not need in your spreadsheet.

☞︎Filter allows you to filter text and numeric data.

☞︎Filter temporarily hides rows of data that you do not need to view.

Answers

Answer:

Filtering procedure provides an essay and convenient way to visualize or work only with the data we desire without needing to delete those we do not need at that moment.

Filter allows you to view only the information you want to see. Only the required information is displayed at that moment once the filter criteria has been checked.

Filter temporarily hides rows of data that you do not need to view. Rows of data which aren't needed at the moment are temporarily hidden in other to allow user concentrate on the needed data.

Filter allows you to filter text and numeric data. Filtering allows for different filtering criteria, if the user requires working or viewing only on text or numeric data, it is possible with spreadsheet filter.

Explanation:

Filter allows you to view only the information you want to see.

Filter temporarily hides rows of data that you do not need to view

Filter allows you to filter text and numeric data.

Answer:

It's A C and D on E d g e n u i t y

Explanation:

How long will it take to transfer a file size of 1GB on a USB 2.0 and a USB 3.0 drive?

Answers

Answer:

A decent SSD connected via USB 3.0,though,could do your 1GB in 2.5 seconds

It will take 17 seconds and 2 seconds for a USB 2.0 and a USB 3.0 drive  transfer a file size of 1GB transfer respectively.

USB 2.0 has a transfer rate of 480 megabits per second.

Therefore the transfer rate of USB 2.0 = (480 * 10⁶  bits per second) / (8 bits per byte) = 60 MBps (megabytes per second)..

Hence the time taken to transfer 1 GB (1024 MB) of data using USB 2.0 = 1024 MB / 60 MBps ≅ 17 seconds

USB 3.0 has a transfer rate of 5 gigabits per second.

Therefore the transfer rate of USB 3.0 = (5 * 10⁹  bits per second) / (8 bits per byte) = 625 MBps (megabytes per second)..

Hence the time taken to transfer 1 GB (1024 MB) of data using USB 3.0 = 1024 MB / 625 MBps ≅ 2 seconds

Hence, it will take 17 seconds and 2 seconds for a USB 2.0 and a USB 3.0 drive  transfer a file size of 1GB transfer respectively.

Find more about USB at: https://brainly.in/question/21354856

What does this mean on Brainly (the time thing )

Answers

It is how long you have to get your daily answer streak

Answer:

Explanation:

That happens if you become idle while writing an answer to a question.

I'm assuming it's to help remind people to finish what they've started.

Other Questions
How is the graph of log (x 2) + 1 translated from the graph of log x? 1.According to Googles Ten Things, information through Google should be available to:a.The richb.Anyonec.The CIAd.The military plz help me how would you solve 4x + 2y = 18, 3x - 5y =20 by elemination Color Blindness in Men and Women The most common form of color blindness is an inability to distinguish red from green. However, this particular form of color blindness is much more common in men than in women (this is because the genes corresponding to the red and green receptors are located on the X-chromosome). Approximately of American men and of American women are red-green color-blind.1 Let and denote the events that a man or a woman is color-blind, respectively. A) If an Americal male is selected at random, what is the probability that he is red-green color-blind? B) If an American female is selected at random, what is the probability that she is not red-green color-blind?C) If one man and one woman are selected at random, what is the probability that neither are red-green color-blind?D) If one man and one woman are selected at random, what is the probability that at least one of them is red-green color-blind? Solve and graph. Thank you so much. The map shows the spread of religions across Europe in the 1500's.Based on the map, which had occurred by 1560? Which function has a negative discriminant value? Select the statements that correctly describe a buffer. a) An acid added to the buffer solution reacts with the weak base of the buffer. b) The pH of a buffer solution is determined by the ratio of the concentration of conjugate base to the concentration of strong acid. c) A buffer is generally made up of a weak acid and its conjugate base. d) The pH of a buffer solution does not change significantly when any amount of a strong acid is added. e) The Ka of a buffer does not change when any amount of an acid is added to the buffer solution. find the derivatives of the following implicit function producer of 80 percent of the rainfall in East Asia Solve The System Of Equations The type of rice that holds its shape best after cooking is The hypotenuse, c, of right triangle ABC is 5.0 cm long. Give the trigonometry ratio cosA=0.50 for angle A, what is the area of the triangle to the nearest tenth of a cm? Hola, amigos! Me llamo Rubn Suarez y vivo en el pueblo de Mendoza, Argentina. Hoy es sbado y mi padre est enfermo. Yo ayudo a mi padre a hacer las diligencias hoy. Mi padre me dice en su lista de diligencias: >. A las siete de la noche la tienda de mi padre se cierra.Mi primo Humberto vive en los Estados Unidos. Su mam es estilista los sbados. Los fines de semana, mi primo maneja y devuelve los libros a la biblioteca. l tambin recoge la ropa en la lavandera. Despus de hacer las diligencias a las 3 de la tarde, compra carne en el supermercado y cena una hamburguesa con su madre.Based on the text, what do both cultures have in common? A preference to use public transportation on weekends A sense of responsibility to assist family The importance of friendship among classmates The pride to continue a family business Brown vs. Board of education was a pivotal legal decision made during the Civil Rights era. Choose the option that correctly gives the decision of the court case and the initial reaction to it by many whites in Southern communities: Question 15 options: A. Made separate but equal in schools legal, allowing segregation; earned the support of many white Southerners in the 1950s B.Made separate but equal in schools illegal, ending Jim Crow laws; Earned the support of many white Southerners in the 1950s C. Made separate but equal in schools legal; caused Southern white opponents to protest the end of Jim Crow laws D. Made separate but equal in schools illegal; caused Southern white opponents to resist the new law by stalling the integration process. Choose the best Spanish word to complete the sentence.Alfonsinade Espaa. What is literacy tension? The graph shows the history of human population growth.Growth of Human Population over HistoryPopulations in billions10,0008000400020006000BCE02000CEWhich statement best describes the growth of the human population? Find the next term in thesequence.Simplify completely.33,33, 3, [?] 16. Terry has a monthly mortgage payment of $979. Her annual property taxes are$1200, her PMI is $62/month, and her homeowner's insurance is $800 per year. Howmuch is deposited into Terry's escrow account each month?