Question: write in fortran please,thanks 1. Create a Fortran MODULE that contains derived types to store information about four geometric figures: circle, square, rectangle, and triangle.
1. Create a Fortran MODULE that contains derived types to store information about four geometric figures: circle, square, rectangle, and triangle. For a circle the structure should store its radius and its centre; for a square, the length of a side; for a rectangle, the lengths of two adjacent sides; and for a triangle, the lengths of the three sides. Your module should include functions to compute the area of each type of shape. Write a program that reads one of the letters c (circle), S (square), R (rectangle), T (triangle), and the appropriate numeric quantity or quantities for a figure of that type, and then calculates its area. For example, the input R 7.2 3.5 represents a rectangle of length 7.2 and width 3.5; and T 3 4 6.1 represents a triangle having sides of lengths 3, 4, and 6.1. The area of a triangle can be found by using Hero's formula: where a, b, and c are the lengths of the sides, and s is one-half of the perimeter. If the user enters an invalid shape, your program should print out Invalid figure type and stop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
