Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help writing this java program Home Work: due 11.02.2016 l. Create a class

ID: 3777322 • Letter: N

Question

Need help writing this java program

Home Work: due 11.02.2016 l. Create a class named TennisGame that holds data about a single tennis game. The class has six fields: the names of the two players, the integer final scores for the players, and the String values of the final scores. Include a get method for each of the six fields. Also include a set method that accepts two players' names, and another set method that accepts the two integer final score values. The integer final score for a player is the number of points the player won during the game; this value should be in the range of 0 through 4. If either of the set method parameters for a score is not in the range of G through 4, assign 0 to both scores and assign "error" to the String scores. If both players' score parameters are 4, sign 0 to both scores and "error" to the String scores. The String score values are set by the method that sets the integer score values. The String final score for each player contains the traditional names for points in tennis: love, 15, 30, 40, or game, respectively, for the values 0 through 4. Create a subclass named Doubles TennisGame that includes two additional fields for the names of the first two players' partners. Include get methods for the names. Override the parent class setNames0 method to accept the names of all four players. Write an application named DemoTennisGames that instantiates several objects of each of these classes. Demonstrate that all the methods assign correct values. Save the files as TennnisGame.java, Double TennisGame. Java, and DennoTennisGames Java

Explanation / Answer

Please find the required program along with its output. Please see the comments against each line to understand the step.

-------------------------------------------------------------------

OUTPUT:

Tennis game between two players
Amy and Bill
Score: 4 to 2
Score: game to 30


Tennis game between two players
Carl and Debbie
Score: 0 to 0
Score: love to love


Tennis game between two players
Emily and Frank
Score: 0 to 0
Score: error to error


Tennis game between two players
George and Hanuah
Score: 3 to 0
Score: 40 to love


Tennis game between four players
Irene and Jill
and Ken and Larry
Score: 4 to 1
Score: game to 15


Tennis game between four players
Mike and Nick
and Olivia and Pam
Score: 0 to 0
Score: error to error


Tennis game between four players
Quentin and Rob
and Sandra and Teresa
Score: 0 to 0
Score: error to error


Tennis game between four players
Ursela and Violet
and Will and Xander
Score: 3 to 0
Score: 40 to love

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote