Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

what the output , input and processing tasks should be to meet the requirements

ID: 3661701 • Letter: W

Question

what the output, input and processing tasks should be to meet the requirements you have been given.

1) (10 pts) A program calculates the volume of a prism whose base is a regular n-sided polygon. A prism is a polyhedron with an n-sided polygonal base. another congruent parallel base (with the same rotational orientation) and in other faces. necessarily all parallelograms) joining corresponding sides of the two base An example of a hexagonal prism is depicted in Figure 1 The formula to calculate the volume of a prism with a regular n-sided polygon base is ha cot Where V: Volume of the prism (in cubic units of length) a: Length of the side of the prism (in units of length) h: Height of the prism (in units of length n: Number of sides of the prism TT: Mathematical constant approximately equal to Figure 1. A hexagonal 3.1416 prism with side length a, cos 0 and height h. Cot: Cotangent trigonometric function cot sin

Explanation / Answer

Good wishes,

The input , processing and out tasks involved in finding the volume of a prism(polyhedron) ia as follows:

Input:

As inputs you need to prompt the user to provide with

Processing:

Coming to the processing part we need to calculate the value of (3.1416/n) and store it in a dummy variable 'd'

d=(3.1416/n)

Next we have to find the value of cot(d)

use specific built-in functions/methods of the language to find cotangent value of 'd' and store it in the variable 'ct'

Next calculate the volume of prism and store it 'v' as below

v= (n/4)*h*a*a*ct

Output:

Now our output is ready and stored in variable 'v', just print it.

Though you did not ask me to write the program using a programming language, I wish to provide you with an implementation of the above steps using 'C' language:

#include <stdio.h>
#include <math.h>
int main()
{
int a,h,n;
float ct,v,d;
printf("Please enter value for Length of the side of the prism(in units of length)");
scanf("%d",&a);
printf(" Please enter value for Height of the prism(in units of length) ");
scanf("%d",&h);
printf(" Please enter value for Numberof sides of the prism");
scanf("%d",&n);
d=3.1416/n;
ct=1/tan(d);
v=(n/4)*h*a*a*ct;
printf(" Volume of the prism is %f ",v);
return 0;
}

sample output:

Please enter value for Length of the side of the prism(in units of length) 2

Please enter value for Height of the prism(in units of length) 3

Please enter value for Numberof sides of the prism 6

Volume of the prism is 1999.98

Hope this is clear.