Answered Essay: Write a program that asks the user to enter a length given in feet and inches where you store feet in a variable of type int and inches in a variable of type doubl

Please help me complete the following in C++

Write a program that asks the user to enter a length given in feet and inches where you store feet in a variable of type int and inches in a variable of type double. Convert this length to meters and centimeters where meters is stored in a variable of type int and centimeters is stored in a variable of type double. Your program should use at least three functions, not including main, that all return void: 1) One function should be used to get two input values from the user by using this new pass by reference mechanism 2) One function should take 4 paramaters, feet, inches, meters and centimeters that after it is run will have changed the values of meters and centimeters so that they represent an equivalent length to our original input value in feet and inches. Here you will still need to use the pass by reference mechanism but notice that you do not need it for all of the parameters. Only use it if you need the function to be able to change the value of the argument you are passing in. 3) The last function should also take 4 parameters and should output the result of the calculation by outputting both the starting values and both of the resulting values. This function should not do any calculations. Your output for inches and centimeters should be displayed in fixed notation, showing the decimal place with 8 decimal digits of precision. In your conversion function, change feet and inches into one variable containing feet and inches combined into some number of feet. Then change those feet into meters by using the conversion factors that there are 0.3048 meters in one foot. Then split those meters into meters and centimeters before returning from the function. You may find the floor function useful in the library There are 12 inches in a foot and there are 100 centimeters in a meter.

Expert Answer

 

Below is your program. Let me know if you have any issue: –

#include <iostream>

#include<cmath>

#include<iomanip>

using namespace std;

void userInput(int& feet, double& inches);

void convertUStoMetric(int feet, double inches,int& meters, double& centimeters);

void output(int feet, double inches,int meters, double centimeters);

int main()

{

int feet,meters;

double inches, centimeter;

userInput(feet, inches);

convertUStoMetric(feet, inches, meters, centimeter);

output(feet, inches, meters, centimeter);

system(“pause”);

return 0;

}

void userInput(int& feet, double& inches)

{

cout << “Enter the length in feet: “;

cin >> feet;

cout << “Enter the length in inches: “;

cin >> inches;

cout << “n”;

}

void convertUStoMetric(int feet, double inches,int& meters, double& centimeters)

{

double totalFtNInch,totalinMet;

totalFtNInch = feet + (inches/12.0);

totalinMet = totalFtNInch * 0.3048;

meters = floor(totalinMet);

totalinMet = totalinMet – meters;

centimeters = totalinMet;

}

void output(int feet, double inches,int meters, double centimeters)

{

cout << “The Initial measurements are ” << feet << ” feets and ” <<fixed<<setprecision(8)<< inches << ” inches.”<<endl;

cout << “The converted measurements are ” << meters << ” meters and ” <<fixed<<setprecision(8)<< centimeters << ” centimeters.”;

cout << “nn”;

}

Sample Run: –

Enter the length in feet: 12
Enter the length in inches: 0.342

The Initial measurements are 12 feets and 0.34200000 inches.
The converted measurements are 3 meters and 0.76184160 centimeters.

Press any key to continue . . .

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?