This Java program calculates the area, perimeter, surface area, and volume of various shapes such as Circle, Rectangle, Square, Sphere, Cylinder, and Pyramid. It presents a menu-driven interface allowing users to choose the shape they want to calculate properties for.
The program consists of a Main class that contains the main menu-driven logic to interact with the shapes. Each shape is represented by a separate class (Circle, Rectangle, Square, Sphere, Cylinder, and Pyramid). Each shape class has methods to calculate its area, perimeter, surface area, and volume. The program uses a loop to repeatedly display the menu until the user chooses to exit.
- Run the
Main.javafile. - Follow the menu prompts to select the shape for which you want to calculate properties.
- Enter the required dimensions when prompted.
- The program will display the calculated area, perimeter, surface area, and volume of the selected shape.
- Choose option 7 to exit the program.