Question: Write a menu-driven C++ program to convert various English distance measurements to their metric equivalents. The program should loop until user exits. The user will
Write a menu-driven C++ program to convert various English distance measurements to their metric equivalents. The program should loop until user exits. The user will select a choice from the menu, and then be prompted to enter an English value to convert. Based on the menu selection, the appropriate function should be called to convert the value to its metric equivalent. The results should be displayed back to the user (e.g. 1 inch is equivalent to 2.54 centimeters), with 2 decimal points of precision. The menu should provide options to convert INCH to CENTIMETER, FOOT to METER, and MILE to KILOMETER (and also an option to exit the program). The following prototypes are provided. You may use additional functions, but these are required: int showMenu(); - gets user choice from menu double getCentimeter(double); - converts inches to centimeters double getMeter(double); - converts feet to meters double getKilometer(double); - converts miles to kilometers Here are some constants you may find helpful: // GLOBAL CONSTANTS const double CENTIMETER_PER_INCH = 2.54; const double METER_PER_FOOT = 0.3048; const double KILOMETER_PER_MILE = 1.6; Possible pseudocode for main() "hello" loop until user exits { call function to show menu and get valid user choice switch on choice { call function based on choice display results } } "goodbye"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
