I have a level 2 programming class i have to take for my major, even though i'm on the IT track and not programming. I struggle alot with programming and was looking to get pointed in the right direction. Below is the directions for my assignment but i honestly have no clue where to start. I passed my intro programming class with a B because my prof gave us 20 min. in class everytime to write code and ask questions as he helped debugg. Can anyone help or point me in the right direction as to what to do with this program? Thanks alot!
Write a program that declares a struct to hold the data of one regular polygon. Since a regular polygon is completely defined by its
number of sides and the length of each of those sides, your struct type, which is to be given a meaningful name, will have two
members; an int for number of sides, and a double for the length of the sides. In your main routine, you will declare an array of your structure type, meaningfully named, with a capacity of 10 elements. Your program will prompt the user for a file name and, if the file is found, it will input the data, which consists of zero or more polygons. Data input will terminate when the end of the file is
encountered or the 10th polygon is input. If the file is not found, the user will be informed, and the program will terminate.
Once the program has input data, it will present a menu to the user which will permit them to perform specific
operations. The L)ist option will print each polygon, one to a line, in tabular form, with appropriate column headers and clean, crisp
margins. For each polygon, list which shape it is, as a string, the lengths of its sides, its area, and perimeter, If the user chooses A)rea or P)erimeter, input which polygon by number, error checking the number (between 0 and the number of polygons minus one) even if you give the user the acceptable range. Output the shape and the value, labeling the value. If the user chooses to quit, prompt them if they really want to quit, and exit only if they confirm.
You must write a fully modular program, where the main routine does little more than call other functions. You must implement functions in your program to perform the following:
Set the number of sides of a polygon
Arguments: Polygon number, number of sides
Set the length of a polygon
Arguments: Polygon number, side length
Get the number of sides: Return number of sides of a polygon
Argument: Polygon number
Get the length of a side: Return side length of a polygon
Argument: Polygon number
Compute and return perimeter: Returns the perimeter of a polygon
Argument: Polygon number
Compute and return the area: Returns the area as a double
Argument: Polygon number
toString: Returns the name of the shape, based on its number of sides (3-8)
Argument: Number of sides
readFile: Inputs the file into the array of Polygon. Reads each polygon's data and fills in a struct element using the functions for
performing those operations.
Argument:s: iostream handle of the data file (must be by reference; why?), array of Polygon, number of Polygons