Hello,
Im new to java and have a question about an assignment I received. If this is not permitted, simply let me know.
I'm confused as to how to assign data to a value and a null string. Here are the first 2 instructions:
a) Use only two private instance variables rank and suit. rank is an integer holding the numeric value of one through thirteen representing the Ace through the King. suit is a String holding the values of either: "clubs", "diamonds", "hearts", or "spades".
b) Write a no argument method, setCard(), assigning data to a value of 1(ace) and a null string.
I am having trouble understanding part b. I understand that rank is an int array but I have no idea how to assign data to both an int and a string.
Im new to java and have a question about an assignment I received. If this is not permitted, simply let me know.
This is ok, asking for the answer or the code is not.
I am having trouble understanding part b. I understand that rank is an int array
No, it says rank is an integer holding a value in the range of 1 to 13. It doesn't say it's an array.
but I have no idea how to assign data to both an int and a string.
The question is badly worded, are you sure this is exactly what you were asked to do?
assigning data to a value of 1(ace) and a null string.
Taken on it's own this makes no sense and even when taken in conjunction with part a it makes little sense. I would say it probably means assign the value 1 to rank and null to suit. ie set suit to be a null string.
Bookmarks