Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Functions with reference parameters: Write a C++ program which includes two functions that calculate unit conversions between a distance expressed in feet and inches, and
Functions with reference parameters: Write a C++ program which includes two functions that calculate unit conversions between a distance expressed in feet and inches, and in meters. The formulas for the unit conversions are: 1 inch0.0254 meters 1 foot = 12 inches The program must meet the following requirements: uirements . Name the source file for your program program6.cpp Throughout the program: - A distance can only be positive or zero (i.e. can't be negative) - A distance in feet and inches will consist of a whole number of feet, and a number (that can include a fraction) of inches that is less than 12 - A distance in meters will be a number that can include a fraction Write the function bodies for the two functions listed below: // Converts meters to feet and inches, and sets the references parameters // feet and inches to the result void meters_to_feet_and_inches (double meters, int& feet, double& inches) // Converts feet and inches to meters and returns the result double feet and inches_to_meters(int feet, double inches) The function meters.to.feet and inches must only calculate the feet-and-inches value that is equivalent to its parameter meters, and set the values of its reference parameters to this calculated value The function feet andinches.to meters must only calculate and value of meters that is equivalent to the sum of its parameters feet and inches, and return this calculated value. In particular, these two functions must not contain any cin or cout statements. .In addition to the required functions listed above, you may use functions of your own design to organize your programn if you want
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started