Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program that prompts the user to enter a number representing a measurem

ID: 3630919 • Letter: C

Question

Create a program that prompts the user to enter a number representing a measurement and then identify whether it is pounds (enter a "P") or yards (enter a "Y"). The program should convert that measurement into either kilograms or meters and output the result as a number with two decimal places. Use four user-defined functions with the following names that accomplish the following: getNumber - obtains from the user a number representing a measurement. This function should use a loop to validate that the input is a number greater than zero. identifylnput - asks the user to identify the number input as pounds by entering a 'P' or yards by entering a 'Y'. This function should use a predefined function to convert the input to an uppercase letter and use a loop to validate that the input is a 'P' or a 'Y' getKilos - Converts pounds to kilograms by multiplying the pounds by 0.45359237 and returns the result. getMeters - converts yards to meters by multiplying the yards by 0. 9144 and returns the result.

Explanation / Answer

#include #include using namespace std; int main() { //PROTOTYPES void getNumber(double& measurement); void identifyInput(char& measurementType); double getKilos(const double& measurement); double getMeters(const double& measurement); //LOCAL DECLARATIONS double measurement; char measurementType; //PROCEDURES getNumber(measurement); identifyInput(measurementType); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote