#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
    {
        // The x and y variables are declared as integers, as only full numbers such as 1 or 2 will be used for choices in the program
        int x, y;
        // Alpha and beta are declared as floats because they represent the users' input in calculations that include decimals
        float alpha, beta;
        // Choice is declared an integer because the choices are made by inputting an integer, therefore choice would have to equal the inputted integer
        int choice;

        // The program asks the user to choose one of 4 shapes to run calculations and show definitions for
        printf ("Choose one of four geometric shapes\n");
        printf ("1: Rectangle\n");
        printf ("2: Circle\n");
        printf ("3: Cylinder\n");
        printf ("4: Sphere\n");

        // this scans the users' choice, as stated earlier before it is an integer hence the %d
        scanf ("%d", &choice);


        // if the user chooses 1, the program will output the definition of the rectangle
        if (choice == 1)
            {
                printf ("Rectangle\nA plane figure with four straight sides and four right angles.\n");
                printf ("Choose one of the following properties to be calculated\n");
                // the program now gives the user the option of choosing either the perimeter or the area
                printf ("1:Perimeter\n");
                printf ("2:Area\n");

                // the program scans the users' choice for the desired calculation
                scanf ("%d", &choice);

                if (choice == 1)
                {
                    // asks the user to input two sides
                    printf ("Enter two sides to find the perimeter of a rectangle\n");
                    // scans the two values for the sides
                    scanf ("%d %d", &x, &y);
                    // outputs the calculation
                    printf ("Perimeter of %d and %d is: %d\n", x, y, 2*(x+y));
                }

                if (choice == 2)
                {
                    // asks the suer to input two sides
                    printf ("Enter two sides to find the area of a rectangle\n");
                    // scans the values for the sides
                    scanf ("%d %d", &x, &y);
                    // outputs the calculation
                    printf ("Area of %d and %d is: %d\n", x, y, x*y);
                }
            }

        // if the user chooses 1, the program will output the definition of the rectangle
        else if (choice == 2)
            {
                printf ("Circle\nA round plane figure whose boundary consists of points equidistant from a fixed center.\n");
                // asks user which caluclation is desired
                printf ("Choose one of the following properties to be calculated\n");
                printf ("1:Circumference\n");
                printf ("2:Area\n");

                // scans users' choice
                scanf ("%d", &choice);

                if (choice == 1)
                {
                    printf ("Enter the radius to find the circumference of the circle\n");
                    // scans users' value for radius
                    scanf ("%f", &alpha);
                    // outputs value for circumference
                    printf ("Circumference of radius %f is: %f\n", alpha, 2*3.14*alpha);
                }

                if (choice == 2)
                {
                    printf ("Enter the radius to find the area of the circle\n");
                    // scans radius value
                    scanf ("%f", &alpha);
                    // outputs area
                    printf ("Area of radius %f is: %f\n", alpha, alpha*alpha*3.14);
                }
            }


        else if (choice == 3)
            {
                printf ("Cylinder\nA solid geometric figure with straight parallel sides and a circular or oval section.\n");
                // asks user to chose one of two calculations
                printf ("Choose one of the following properties to be calculated\n");
                printf ("1:Surface area\n");
                printf ("2:Volume\n");
                // scans's users' choice
                scanf ("%d", &choice);

                if (choice == 1)
                {
                    printf ("Enter the radius and height to calculate the surface area\n");
                    // scans user's radius and height
                    scanf ("%f", &alpha);
                    scanf ("%f", &beta);
                    // outputs surface area value
                    printf ("Surface area of %f and %f is: %f\n", alpha, beta, (2*3.14*(alpha*alpha)) + (2*3.14*alpha*beta));
                }

                if (choice == 2)
                {
                    printf ("Enter the radius and height to calculate the volume\n");
                    // scans user's radius and height
                    scanf ("%f", &alpha);
                    scanf ("%f", &beta);
                    // outputs volume value
                    printf ("Volume of %f and %f is: %f\n", alpha, beta, pow((3.14*alpha),(2*beta)));
                }
            }


        else if (choice == 4)
            {
                printf ("Sphere\nA round solid figure, or its surface, with every point on its surface equidistant from its center.\n");
                // asks user to chose desired calculation
                printf ("Choose one of the following properties to be calculated\n");
                printf ("1:Surface area\n");
                printf ("2:Volume\n");
                // scans user's choice
                scanf ("%d", &choice);

                if (choice == 1)
                {
                    // asks user for radius
                    printf ("Enter the radius to calculate the surface area\n");
                    // scans user's radius
                    scanf ("%f", &alpha);
                    // outputs surface area value
                    printf ("Surface area of radius %f is: %f\n", alpha, 4*3.14*(alpha*alpha));
                }

                if (choice == 2)
                {
                    // asks user for radius
                    printf ("Enter the radius to calculate the volume\n");
                    // scans user's radius
                    scanf ("%f", &alpha);
                    // outputs volume value
                    printf ("Volume of radius %f is: %f\n", alpha, 0.75*3.14*(alpha*alpha*alpha));
                }
            }

        return 0;
    }
