Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write it in C please its intro to programming so may you please write it simply so i can learn and understand from it

please write it in C please its intro to programming so may you please write it simply so i can learn and understand from it please
image text in transcribed
image text in transcribed
image text in transcribed
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 500 880 40 60 75 100 1000 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 Below 18.5 18.5-24.9 25.0-29.9 30.0 and above Weight Status Underweight Normal Overweight Obese 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). 1 3. Write a program that takes the x-y coordinates of a point in the Cartesian plane and prints a message telling either an axis on which the point lies or the quadrant in which it is found. (25 points) QUI QI Et Sample lines of output: (-1.0, -2.5) is in quadrant III 10.0, 4.8) is on the y-axis (0.0, 0.0) is on the origin Olli OIV Note: The function for this program takes the x-y coordinates as inputs, and returns the quadrant number to the calling function. Then print a message regarding the location of the coordinates. 4- This problem is for fun and to understand the importance of braces {} better. Modify the following code to produce the output shown. (25 points) Use proper indentation techniques. You may not make any changes other than inserting braces. The compiler ignores the indentation in a program. The indentation from the following code has been eliminated to make the problem more challenging, [Note: It's possible that no modification is necessary.] if (y == 8) if (x = 5) printf("@@@@@ "); else printf( "##### "); printf( "$$$$$ "); printf("&&&&& "); a) Assuming x = 5 and y = 8, the following output is produced. aaaaa $$$$$ &&&&& b) Assuming x = 5 and y = 8, the following output is produced. aaaaa &&&&& c) Assuming x = 5 and y = 7, the following output is produced. (Note: The last three printf statements are all part of a compound statement.) ### $$$$$ &&&&& Note: Solve every part of the problem inside a void function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

Students also viewed these Databases questions