Hello, i have a class "Die" and a class "PairOfDice" pair of dice extends die. i need to instance variables of type die in pairofdice constructor... i think.
here are constructors for die and pairofdie.. we learned all of this earlier this semester but apparently i didn't learn it well cause i can't remember how to do it. heres my constructors.

public Die()
public PairOfDice()

i dont really get why they want us to create it like this when i can simply create 2 objects of die and roll each of those. but it instead wants both dice to be in one class i think?, im assuming it wants us to simulate rolling two dice as if you had them in your hand. so thats why. but i still don't understand how to do that. you dont gotta give me the answer but i just need help

6 Years
Discussion Span
Last Post by JamesCherrill

Class structure looks dumb to me. 2Dice is not a "kind of " Die.
It would make more sense to have a (non-subclassed) class called "HandfullOfDice" that took an int numberOfDie as a param on the constructor, had a list of Die objects as an instance variable, and had public methods like rollAllDice and getTotalScore etc.

Votes + Comments
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.