Overclock.net banner

1 - 5 of 5 Posts

·
Registered
Joined
·
348 Posts
Discussion Starter #1
import apcslib.*;<br />
import chn.util.*;<br />
<br />
public class Card {<br />
//instance variables<br />
private String mySuit;<br />
private String myCardName;<br />
private int myValue;<br />
<br />
//Constructors<br />
public Card()<br />
{<br />
mySuit = "";<br />
myCardName = "";<br />
myValue = setValue();<br />
}<br />
<br />
public Card(String suit, String cardName)<br />
{<br />
mySuit = suit;<br />
myCardName = cardName;<br />
myValue =setValue();<br />
}<br />
<br />
//Modifiers<br />
private int setValue()<br />
{<br />
<b> //your assignment tonight is to fill this in......<br />
//What goes here??</b><br />
return 0;<br />
}<br />
<br />
//Accessors<br />
public String getSuit()<br />
{<br />
return mySuit;<br />
}<br />
<br />
public int getValue()<br />
{<br />
return myValue;<br />
}<br />
}
 

·
Premium Member
Joined
·
3,590 Posts
Well I don't want to just answer it for you. I think your making it to hard on yourself. How do you modify a variable, or in other terms change it? Got any ideas that come to mind?
 

·
Premium Member
Joined
·
5,282 Posts
Do you want it to be randomly assigned? How is the value determined<br />
<br />
Also, why does setValue() return int? Just make it return void
 

·
Premium Member
Joined
·
3,590 Posts
Also Modifier/Setter shouldn't return anything, thats what the get methods are for. The setters are just assigning the variable the new data.
 
  • Rep+
Reactions: cisf0rcalvin

·
Registered
Joined
·
348 Posts
Discussion Starter #5
thx i got it =]
 
1 - 5 of 5 Posts
Top