3.3. ExercisesΒΆ

  1. Write an equals method for the fraction class that returns true is two fractions are equal and false otherwise.
  1. Write sub, mul, and div for the Fraction class.
  1. Write a class that represents a Rectangle. Your constructor should take a length and a width. Write an area method that returns the area of the rectangle.
  1. Write a class the old way that represents a Rectangle. Your constructor should take a length and a width. Write an area method that returns the area of the rectangle.
  1. Write a class Stack that implements the stack data type, with a push, pop, peek, size, and isEmpty as the methods.
  1. Write a class Cat that inherits from Animal.
Next Section - 4. Part III: Advanced Topics