Question: answer in java programming language 10. Expanding the Class a. Write a concise and precise class invariant for the games instance variable in terms of

answer in java programming language
answer in java programming language 10. Expanding the Class a. Write a
concise and precise class invariant for the games instance variable in terms
of the other instance variables. b. Write the prototype (method header) for

10. Expanding the Class a. Write a concise and precise class invariant for the games instance variable in terms of the other instance variables. b. Write the prototype (method header) for a numWins method that returns the number of wins as its integer return value. It has no parameters. Write prototype only. c. You want to print a win-loss-tie record (such as 3-1-1) in Game.java. Describe in precise words (not code) the best way to go about doing this. What would change where? // Game.java // Record.java IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII public class Record { private int wins; private int losses; private int ties; private int games; public class Game public static void main(String[] args) { Record papers = new Record(); Record scissors = new Record(); papers.addGame(4, 3); scissors.addGame(0, 4); print("Papers", papers); print("Scissors", scissors); papers.addGame(5, 7); scissors.addGame(4, 6); scissors.addGame(9, 1); papers.addGame(3, 7); scissors.addGame(7,3); papers.addGame(0,5); papers.addGame(1, 4); scissors.addGame(3, 1); print("Papers", papers); print("Scissors", scissors); public Record() { wins = 0; losses = 0; ties = 0; games = 0; public void addGame (int us, int them) { if (us > them) { wins++; } else if (us 0) { return (wins *100)/games; } else { throw new ArithmeticException ("divide by zero"); Two possibilities: 1) Create accessor methods for numWins, numLosses, num Ties on Record class. Call these from Game.java 2) Create a String method on Record class that returns formatted record. Call this from Game.java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!