Question: please write C program. 1. Prompt the user to enter the first letter of a shape(accept either uppercase or lower case letters) as referred to

please write C program.
please write C program. 1. Prompt the user to enter the first

1. Prompt the user to enter the first letter of a shape(accept either uppercase or lower case letters) as referred to in the table below. Using a switch statement, prompt the user to enter the data needed, calculate the area of the shape, and output the area. (all within the switch statement). For example, if the user enters R as their shape, then inside the switch, the program should prompt them to enter I and w, calculate the area of the rectangle, and print the area of the rectangle to the screen. Your switch statement should include a default that will print a message that the user has entered an invalid character if they enter something other than the letters listed in the first column of the table below. User inputs... Shape Data to read in... Formula for area: "C" or "c" Circle Radius (0 A = n2 "R" or " Rectangle Length (L) and Width (w) A=l.w "S" or "S" Square Length (1) A = 12 "T" or "1" Trapezoid Length of base a (a), Length of base (b). (a + b) A -h Height of Trapezoid (h) 2 Your output should include the name of the shape, the input that is read in from the user, and the calculated area. Include 2 decimal places in the area output. Declare Pl as a constant double with a value of 3.14159. Your output should look something like this: The area of a square with sides of length 10.2 is 104.04. Test your program with: 1 = 6.3 W = 4.3 a. (Lower case letter r): b. P (Upper case letter P). C. C (Upper case letter C): d. t (lower case letter t): T= 8.3 a = 6.8 b = 10.2 h = 4.5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!