Hi guys im trying to create a simple card game. This is the last class i need to create in order for my assignment
to be finished and im very stuck!
Here are my instructions -
The Game class has two fields representing Player one and Player two.
The constructor for this class has two parameters which are the names of the two players. The
constructor will initialise the two fields.
The Game class has a single method called play which has no parameters and does not return
a value. This method should print out a suitable introduction and then:
1. Instruct player one to play first. The instruction should give the name of player one.
so something like system.out.prin tln("Player One needs to go first") but how to i call the getName method i have which is in another class and connect it here?
2. Invoke the play method of Player one.
this bit i dont understand, because there is simply one play method right? The instructions dont indicate 2 seperate
play methods for each player?
3. Announce the score for Player one.
Simply again, im not sure how to call a method which is in another class.
any input would be appreciated.
to be finished and im very stuck!
Here are my instructions -
The Game class has two fields representing Player one and Player two.
The constructor for this class has two parameters which are the names of the two players. The
constructor will initialise the two fields.
The Game class has a single method called play which has no parameters and does not return
a value. This method should print out a suitable introduction and then:
1. Instruct player one to play first. The instruction should give the name of player one.
so something like system.out.prin tln("Player One needs to go first") but how to i call the getName method i have which is in another class and connect it here?
2. Invoke the play method of Player one.
this bit i dont understand, because there is simply one play method right? The instructions dont indicate 2 seperate
play methods for each player?
3. Announce the score for Player one.
Simply again, im not sure how to call a method which is in another class.
any input would be appreciated.
Comment