Question: The code given: // Lab 6 kiloConverter.cpp // This menu-driven program lets the user convert // pounds to kilograms and kilograms to pounds. // PUT
The code given: // Lab 6 kiloConverter.cpp // This menu-driven program lets the user convert // pounds to kilograms and kilograms to pounds. // PUT YOUR NAME HERE. #includeusing namespace std; // Function prototypes // WRITE PROTOTYPES FOR THE displayMenu, getChoice, // kilosToPounds and poundsToKilos FUNCTIONS HERE. /***** main *****/ int main() { // DECLARE ANY VARIABLES MAIN USES HERE. // WRITE THE CODE HERE TO CARRY OUT THE STEPS // REQUIRED BY THE PROGRAM SPECIFICATIONS. return 0; } /***** displayMenu *****/ // WRITE THE displayMenu FUNCTION HERE. // THIS void FUNCTION DISPLAYS THE MENU CHOICES // 1. Convert kilograms to pounds // 2. Convert pounds to kilograms // 3. Quit /***** getChoice *****/ // THIS IS THE SAME FUNCTION YOU WROTE EARLIER IN THIS SET // OF LAB EXERCISES. JUST FIND IT AND PASTE IT HERE. /***** kilosToPounds *****/ // WRITE THE kilosToPounds FUNCTION HERE. // IT RECEIVES A WEIGHT IN KILOS AND MUST CALCULATE // AND RETURN THE EQUIVALENT NUMBER OF POUNDS. /***** poundsToKilos *****/ // WRITE THE poundsToKilos FUNCTION HERE. // IT RECEIVES A WEIGHT IN POUNDS AND MUST CALCULATE // AND RETURN THE EQUIVALENT NUMBER OF KILOS.
Lab 6.7 Complete Program
Step 1: Remove swapNums.cpp from the project and add the kiloConverter.cpp program in your Lab6 folder to the project. This file contains just a program shell in which you will write the programming statements needed to complete the program described below. Here is a copy of the file.
1 // Lab 6 kiloConverter.cpp 2 // This menu-driven program lets the user convert 3 // pounds to kilograms and kilograms to pounds. 4 // PUT YOUR NAME HERE. 5 #include
Step 2: Design and implement a modular, menu-driven program that converts kilograms to pounds and pounds to kilograms. 1 kilogram = 2.2 pounds. The program should display a menu, accept and validate a user menu choice, get the amount of weight to be converted, call the appropriate function to do the conversion, and then print the returned result. The code should continue iterating to allow additional conversions to be done until the user enters the menu choice to quit. When the program runs it should look somewhat like the sample run shown here.
Sample Run
1. Convert kilograms to pounds
2. Convert pounds to kilograms
3. Quit
1
Weight to be converted: 4
4 kilograms = 8.8 pounds.
1. Convert kilograms to pounds
2. Convert pounds to kilograms
3. Quit
2
Weight to be converted: 10
10 pounds = 4.54545 kilograms.
1. Convert kilograms to pounds
2. Convert pounds to kilograms
3. Quit
3
Step 3: Once your program is written and compiles with no errors, thoroughly test it.
Step 4: If your professor asks you to do so, print the completed source code and the output produced by executing it , selecting each menu choice at least once.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
