Question: what is the java code for below program Task 2 : The PongScore Class: Description: The PongScore class describes the object that the Pong
what is the java code for below program Task : The PongScore Class:
Description:
The PongScore class describes the object that the Pong application uses to keep track of the score for each player. The following class diagram illustrates the information and operations that are defined by the PongScore class.
PongScore Class Diagram:
Class: PongScore
Constructor: PongScore
Methods:
int getScore
void scorePointsint points
When the Pong application is executed it creates two PongScore objects, one for the blue player and one for the green player. Each time the ball contacts the end wall behind the blue paddle, the scorePoints method of the green player's PongScore object is invoked, and vice versa. When invoking the scorePoints method, the Pong application passes it an argument corresponding to the number of points indicated in the region of the wall that was contacted. The Pong application will then invoke the getScore method to determine the score to be displayed beside the player's name below the playing field.
Implementation:
Implement the PongScore class in the file PongScore.java in your CISAPong directory. Your implementation must meet the specifications given in the Java Documentation for the PongScore class Links to an external site..
To compile the java class, use this command: javac PongScore.java
Testing:
To test the PongScore class write a class named PongScoreTest that contains a main method. Your PongScoreTest program should use a format similar to that used in PongBallTest. Be sure to create several PongScore objects and to call the scorePoints method with several different arguments.
Integration:
Once you have fully tested your PongScore class you can integrate it into the Pong application.
When you run the Pong application and press the B key, the ball will again begin to bounce around the playing field. However, now each time the ball contacts the end wall the opponent's score will be incremented by the appropriate number of points."
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
