C LANGUAGE Write a menu-driven program for the following, use case/switch statement: LOL MENU 1. QUADRATIC EQUATION 2. BMI CALCULATOR 3. SUM OF ODD NUMBERS 4. EXIT CHOICE: NOTE: Input another choice, if the choice is invalid.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter1: A First Program Using C#
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

IN C LANGUAGE

Write a menu-driven program for the following, use case/switch statement:
LOL MENU
1. QUADRATIC EQUATION

2. BMI CALCULATOR

3. SUM OF ODD NUMBERS

4. EXIT

CHOICE:
NOTE: Input another choice, if the choice is invalid.

 

Case 1: password to open: 1111 (back to main if the password is invalid) 

Create a program that will calculate and display the real roots of the quadratic equation: ax2 + bx + c = 0 using the quadratic formula: x = (-b ± sqrt of b- 4ac) / 2a

Make sure that the b2 > 4ac, so that the calculated roots will always be real. And that a must not be equivalent or less than 0. 

Note: Back to main after performing case 1 or exit

 

Case 2: password to open: 1234 (back to main if the password is invalid)

Create a program that will calculate Body Mass Index (BMI) and will indicate the status of your BMI. Using ladderized if-else. 

BMI = ([Weight in Pounds) / (Height in inches) x (Height in inches)] x 703

BMI = (Weight in Kilograms) / (Height in meters) x (Height in meters)

Your program must accept weight in pounds or kilogram, and height in inches or meters. 

Formula: 

1 ft = 12 inches

1 meter = 39.3701 iches 

1 in = 0.0254 m 

1 kg = 2.2 lb

1 lb =  0.454 kg

BMI Categories: 

Underweight = <18.5

Normal weight = 18.5 - 24.9

Overweight = 25 - 29.9

Obesity = BMI of 30 or greater

Sample Program: 

Weight (Input 1 for Lb, input 2 for kg): 1

Input weight in Lb: 220

 

Height (Input 1 for inches, input 2 for meters): 2

Input height in meters: 2

Your BMI is: 24.9

BMI Category: NORMAL WEIGHT

Note: Back to main after performing case 2 or exit

 

Case 3: password to open: 1011 (back to main if the password is invalid)

Write a program that will compute for the sum of 10 odd numbers only beginning on user's input: (use do-while loop)

 

Sample:

Input a number: 4 (if the input number is even, add 1 to make it odd)

Ten odd numbers beginning at 4: 5, 7, 9, 11, 13, 15, 17, 19, 21, 23

Sum: 140

Note: Back to main after performing case 3 or exit

 

-End-

Expert Solution
steps

Step by step

Solved in 5 steps with 6 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,