Question: Program in java Concept for Our Part of the Game Code When a goat's score changes, it triggers two changes: 1. The Point Display for
Program in java

Concept for Our Part of the Game Code When a goat's score changes, it triggers two changes: 1. The Point Display for the goat is changed. 2. A Winner Display to declare the winner when a goat gets to 1000 points. The Observer pattern is well-suited for this problem. Each player is a Source and both Displays are Observers. Program Design Have a Goat Class that extends Observable (or Submission Publisher). In Goat, have a name field (String) and a score field (int). Write a getter and setter for both. The constructor should set the score to 0 and assign your goat a name. Goat needs a method named addPoints(int) that adds points to the Goat's score.addPoints(int) calls setchanged() and notifyObservers() to signal that the score has changed (in addition to changing the score for a Goat). In add points, do nothing if the parameter is less than or equal to 0. Each play has a goat. Create two classes that implement Observer (or Subscriber), named PointDisplay and Winner Display. Both displays will observe both goats. o update in PointDisplay will output "
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
