Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Microsoft Word - Document1 ELET 2300: Introduction to C++ Programming Fall 2020 Lab 2 Deadline: Fr. October 16, 11:00 PM Please work on the following labs and submit your solutions on a single .txt...

1 answer below »
Microsoft Word - Document1
ELET 2300: Introduction to C++ Programming Fall 2020
Lab 2


Deadline: Fr. October 16, 11:00 PM


Please work on the following labs and submit your solutions on a single .txt file


1. Write a menu driven C++ program that performs the following operations (use switch
case):
a. Convert Miles to Kilometers
. Convert degrees Fahrenheit to degrees Celsius
c. Convert Kilograms to Pounds
Display appropriate message if the user enters a wrong option.


2. Write a C++ program that accepts the weight and height from the user. Calculate the
BMI of the user and print the result based on the following rules:

- If BMI < 20 then result = Underweight
- If BMI >= 20 and <= 24 then result = Normal Weight
- If BMI >= 25 and <= 29 then result = Overweight
- If BMI >= 30 and <= 39 then result = Obese
- If BMI >= 40 then result = Extreme Obesity

3. Write a C++ program with a user defined function myFactorial, that calculates the
factorial of a number entered by the user. Return the calculated factorial and print it in
the main function.
Answered Same Day Oct 16, 2021

Solution

Shivam answered on Oct 16 2021
148 Votes
Program 1
#include using namespace std;
int main() {
int num;
cout
"Enter 1 if you wish to convert miles to kilometers \n";
cout
"Enter 2 if you wish to convert degrees Fahrenheit to degrees Celsius \n";
cout
"Enter 3 if you wish to convert Kilograms to Pounds"
endl;
while(1){
cin
num;
if ((num == 1) || (num == 2) || (num == 3))

eak;
else{
cout
"Please enter appropriate input"
endl;
}
}
switch (num) {
case 1:
float miles,temp;
cout
"Enter miles";
cin
miles;
temp = miles * 1.60934;
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here