Courses‎ > ‎AP Computer Science‎ > ‎Konstantinovich‎ > ‎notes‎ > ‎

2017-10-18 HW

posted Oct 18, 2017, 11:10 AM by Konstantinovich Samuel

Think about the behavior of the class:
-Is the class mutable?
-When do you NEED to reduce?
-What happens with a zero denominator?
-What happens when the ratio is negative?
-What happens when you display a number with a numerator of 0, or a denominator of 1?

  set numerator and denominator
  change 0 denominators to 1.
  change negative denominators by negating both numerator and denominator

  display integers without a denominator. (0 numerator, or 1 as a denominator)

Numer class hierarchy:
Real Number