Write a class called Pyramid
, each pyramid has some properties: length of the base
, height
and number of sides
(in this order!) that should always be present.
The task is to calculate the volume of the pyramid. Keep in mind the following instructions:
- A pyramid is supposed to have 3 or 4 sides. If one tries to create a pyramid with any other number of sides, the number of sides will be fixed to 4. If this is the case, make sure to report that the input is changed.
- Assume the width and length of the pyramid are the same.
- The calculation of the volume should be done in the following method:
getVolume()
which returns a double.
- If you do not remember the formula for the volume of a pyramid: Google is your friend!
- There is no need to implement a
main()
method.

Adapted from Pyramid - Dark meme university