Search lessons

Suggested searches

Browse

Objects

Goals

  • Learn how to make utility classes to organize code
  • Learn OOP concepts
    • Inheritance
    • Polymorphism
  • Learn how to make classes and objects
  • Learn the difference between static and non-static methods
  • Learn what interfaces are

Tasks

  • Person
    • Create a person class that includes variables for name, age, eye color, hair color, height, etc.
    • Create a constructor to initialize these variables.
    • Create a function that prints all of its properties.
  • Create a class called Point that includes an X and a Y coordinate.
    • Create a function that takes in another Point object and returns the distance between the two.
    • Create a function that takes in another Point object and returns the midpoint between the two.
  • Pokemon
    • Create a class called Pokemon which includes HP, Speed, Defense, and Attack which are integers on a scale of 1-10.
    • It should also includes its type which is included in an enum class.
    • Create a function that allows a Pokemon to battle another given Pokemon and deduct health dependent on defense and attack.
    • Bonus: Implement types that make certain Pokemon stronger and weaker against others.

Reference