[SOLVED] CS2050 Activity 4

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (5 votes)

In this activity you will create unit tests for specialized solid classes: Cube, Pyramid, and Cylinder. You will also generate documentation for the classes that you will implement.
Solid
The Solid class is an abstract class that defines a method to compute the volume of a solid.
Cube
The Cube class extends Solid and overrides the volume method according to the formula below.

Implement 2 constructors for the Cube class: one that takes the side of the cube (if the informed value is invalid, then it should default to Solid.DEFAULT_MEASURE); and another that sets its side to Solid.DEFAULT_MEASURE automatically.
Make sure that your implementation passes all of the tests defined in CubeTest. When you are done, document your class using JavaDoc’s format.
Pyramid
Begin by writing PyramidTest first. When you are satisfied with your tests, write the Pyramid class implementation, similarly to what was done in Cube. For example, have the measures default to Solid.DEFAULT_MEASURE if the informed value is invalid. Also, write a constructor that creates a Pyramid using Solid.DEFAULT_MEASURE for length, width, and height.

Cylinder
Use a similar approach to implement the CylinderTest and Cylinder classes.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.