Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C LANGUAGE PLEASE NOT C++ Problem: The user will provide a positive integer value as the first input representing the options described below. 1

IN C LANGUAGE PLEASE NOT C++

Problem: The user will provide a positive integer value as the first input representing the options described below.

1 A circle with an equilateral [T]riangle inscribed.

2 A circle with a [S]quare inscribed.

3 or larger A regular polygon with a [C]ircle inscribed. The number of sides of the polygon is equal to the integer input.

The second input is the area of the figure (circle for options 1 and 2, polygon for 3 or larger). Your program will calculate the radius or apothem and area of the inscribed figure.

Example Execution #1 (circle with [T]riangle inscribed):

Enter desired option -> 1

Enter area of figure -> 150

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Radius/Apothem of figure with area given: 6.9

Area of inscribed figure [T]: 62.0

Example Execution #2 (circle with [S]quare inscribed):

Enter desired option -> 2

Enter area of figure -> 255.45

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Radius/Apothem of figure with area given: 9.0

Area of inscribed figure [S]: 162.6

Example Execution #3 (Pentagon with [C]ircle inscribed):

Enter desired option -> 5

Enter area of figure -> 5500

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Radius/Apothem of figure with area given: 38.9

Area of inscribed figure [C]: 4756.4

Example Execution #4:

Enter desired option -> 10

Enter area of figure -> 52000

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Radius/Apothem of figure with area given: 126.5

Area of inscribed figure [C]: 50277.9

Additional Requirements:

Your program must accept input and produce output exactly as demonstrated in the example executions, do not add any bonus features not demonstrated in the example executions. Your program will be tested with the data seen in the example executions and an unknown number of additional tests making use of reasonable data.

The input of the option will always be a positive integer value and all floating-point variables must be of the double type.

Use the constant value M_PI where needed for the constant pi.

The number of sides of the regular polygon will always be a positive integer value.

Any use of logical operators, relational operators, bool variables, or selection constructs is prohibited.

All code for this assignment will be placed inside of the main 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_2

Step: 3

blur-text-image_3

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions