Original program: A06.java, Gyeser.java   [code-at-a-glance handout]

This is a nicely written procedural program that simulates the eruption of geysers using a model that basically says that the probability of a given geyser not blowing decreases exponentially day-by-day. Compile and run it as shown below:

Note: Here's how we describe a geyser:
Smokey 0.05 3
  \      \   \__days since last blow	  
   \      \_initial probability of blowing
    \_name of geyser
~/$ java A06 2018
3 Smokey 0.05 3 ShortStack 0.09 1 Itchy 0.25 0
Day 1: Itchy
Day 2:
Day 3: Smokey
Day 4: Itchy
Day 5: ShortStack
Day 6:
Day 7: Itchy
Day 8: ShortStack, Itchy
Day 9:
Day 10:
Day 11: Itchy
Day 12: Smokey
Day 13: ShortStack
Day 14:
Day 15: Itchy
Day 16: Itchy
Day 17: Smokey, ShortStack
Day 18:
Day 19:
Day 20: ShortStack, Itchy

  1. [10pts] Describe one way in which the above program violates the principle of encapsulation?
  2. [10pts] Describe one way in which the above program violates the principle of information/data hiding?
  3. [70pts] Rewrite the above program as a proper object-oriented program — at least as far as we know how at this point. That means proper use of encapsulation and data/information hiding. The rules are simple:
    1. the input/output behavior of the program stays the same
    2. the main() for the program stays in class A06
    3. the class Geyser remains in its own file, i.e. not an inner class of A06
    4. the principles of encapsulation and information/data hiding are followed to the utmost — no public data members for example
  4. [10pts] Given your rewriting, what is the "interface" to your class Geyser?