-- removed inline image ---
Using Excel’s VBA, write a program to perform volume calculations on a set of shapes in accordance with the instructions and similar to the spreadsheet layout below:
• Three types of shapes are to be processed: 1-cylinder, 2-cone, and 3-sphere segment.
• Volume equations for the shapes are as follows:
Volcyl = πr2h
Volcon = πr2h/3
Volsph = πr2h/2+ πh3/6
Where r=radius, h=height
• Data defining the shapes will be read directly from the spreadsheet. The program will read one row of data at a time. Each row of data will contain the shape type (1 = cylinder, 2 = cone, 3 = sphere segment), radius and height of the shape. The program will continue to read and process shape data until it reaches a blank row.
• The main program will use a single subroutine or function to calculate the volume of each shape and return this data to the main program. The main program will immediately output the results in a cell adjacent to each row of data.
• The program will also calculate summary data in a 2D array (4 rows x 2 columns, as shown in the spreadsheet above), including: o Total count of each shape
o Total count of all shapes
o Total volume of each shape
o Total volume of all shapes
• The summary statistics should be written back to the spreadsheet
• The program should also check for illegal data including o Negative numbers
o Illegal or undefined volume types
Using Excel’s VBA, write a program to perform volume calculations on a set of shapes in accordance with the instructions and similar to the spreadsheet layout below:
• Three types of shapes are to be processed: 1-cylinder, 2-cone, and 3-sphere segment.
• Volume equations for the shapes are as follows:
Volcyl = πr2h
Volcon = πr2h/3
Volsph = πr2h/2+ πh3/6
Where r=radius, h=height
• Data defining the shapes will be read directly from the spreadsheet. The program will read one row of data at a time. Each row of data will contain the shape type (1 = cylinder, 2 = cone, 3 = sphere segment), radius and height of the shape. The program will continue to read and process shape data until it reaches a blank row.
• The main program will use a single subroutine or function to calculate the volume of each shape and return this data to the main program. The main program will immediately output the results in a cell adjacent to each row of data.
• The program will also calculate summary data in a 2D array (4 rows x 2 columns, as shown in the spreadsheet above), including: o Total count of each shape
o Total count of all shapes
o Total volume of each shape
o Total volume of all shapes
• The summary statistics should be written back to the spreadsheet
• The program should also check for illegal data including o Negative numbers
o Illegal or undefined volume types