Reputation: 33
I am supposed to be writing a java program for a rock paper scissors game. I understand what I am supposed to do however this part confused me.
The implementation involves creating three files. One file contains the client code and the other two files are the classes. The design for the classes should be:
Class player
Variables: playerName, playerThrow
Methods: makeThrow-prompts player for the throw
getThrow-returns the players throw
Class Game
Variables: compThrow,playerWins,playerThrow
Methods:
makeCompThrow- generates comp throw
getCompThrow- returns the throw
announceWinner- displays the messages for throws and winner
bigWinner- determine overall winner
I am really confused as to what this means as in what the client code is. Is that like a menu? And how do i get the two classes to work in conjunction with it. Any clarification would be appreciated and please be kind.
Upvotes: 0
Views: 80
Reputation: 911
I am unable to comment since I don't have enough reputation.
As Makoto pointed out, only your professor can really tell what needs to be done here. That being said, here's what I think is being asked:
The client code will contain the main function. It will contain the code to call the methods in the classes. For example, it would ask the player to pick one of the three options (rock, paper, scissor) by calling player.makeThrow()
. Basically, client code is the link between the two classes. That is how the two classes are going to work in conjunction.
Upvotes: 1