Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the programming language C, write the following codes: 1. a) Write a switch statement that assigns to the variable lumens the expected brightness of
In the programming language C, write the following codes:
1. a) Write a switch statement that assigns to the variable lumens the expected brightness of a standard light bulb whose wattage has been stored in watts. Use the following table. Assign -1 to lumens if the value of watts is not in the table. (25 points) b) Write a nested if statement equivalent to the switch statement for the variable lumens. Watts Brightness (in Lumens) 15 125 25 215 40 500 60 880 75 1000 100 1675 Note: Create two functions and for each part of this problem, which take as input the watts and return the brightness in lumens. Don't forget to also display the brightness value. 2- Write a program that calculates the user's body mass index (BMI) and categorizes it as underweight, normal, overweight, or obese, based on the following table from the United States Centers for Disease Control: (25 points) BMI Weight Status Below 18.5 18.5-24.9 Underweight Normal Overweight Obese 25.0-29.9 30.0 and above To calculate BMI based on weight in pounds and height in inches, use this formula (rounded to tenths): 703 x weight(lb) BMI = (height(in)) a) Write a BMI calculator function that accepts the weight and height as inputs and returns the BMI values. b) In another function, prompt the user to enter weight in pounds and height in inches. c) Use a function call to calculate BMI. d) Based on the BMI, determine the weight status and display the results (BMI and weight status)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started