Java SE 8 API documentation

Last modification: 29/11/16

  1. The Month enumeration

    Create an enumeration which includes every month. We will use it in the below Date class.

  2. The Date class

    Create a Date class which represents dates. Use the above Month type to represent months. Override the equals() method of Object.

    Create a DateDemo class which stores some dates in a HashSet and prints the contents of the set to the output. Create several Date objects representing the same date, and add them to the set. What happened?

  3. Thepolyhedra.Prismabstract class

    Create a Prism class in polyhedra package which represents prisms.

    1. Store the height of the prism as a double field.

    2. Add a constructor that takes the height of the prism as argument and initializes the field.

    3. Add an abstract area() method.

    4. Add a final volume() method that calculates the volume using the height and the surface area.

    5. Make the inherited toString() method abstract.

    6. Override the inherited equals() method which decides equality based on volume.

  4. The Cylinder class

    Create a Cylinder class in polyhedra package which inherits from the Prism class.

    1. Implement the abstract area() and toString methods.

    2. Prohibit the inheritance from Cylinder by making it final.

  5. The Cube class

    Create a Cube class in polyhedra package which inherits from the Prism class.

    1. Implement the abstract area() and toString methods.

    2. Prohibit the inheritance from Cube by making it final.

  6. Comparing prisms by volume

    Create a class that can compare two prisms by their volumes, that is it implements the java.util.Comparator interface.

    The point of this class is to be able to sort prisms in ascending order according to their volumes using the java.util.Collections.sort() method.

  7. Comparing prisms by surface areas

    Create a class that can compare two prisms by their surface areas, that is it implements the java.util.Comparator interface.

    The point of this class is to be able to sort prisms in ascending order according to their surface areas using the java.util.Collections.sort() method.