Enum Class DiceType
- All Implemented Interfaces:
Serializable
,Comparable<DiceType>
,Constable
Enumeration representing different types of dice. Ranges from D4 to D20. The following types of
dice exist: D4, D6, D8, D10, D12, D20 (the enum constants below). Case matters, we will be using
uppercase for this assignment.
Keep the enum simple. Javadoc automatically generates methods that are created behind the scenes
NOTE: the enum type will automatically add the following methods:- static DiceType valueOf(java.lang.String name)
- static DiceType[] values()
- DiceType()
Enum Creation
As a reminder, enums are relatively simple to create. Don't let the javadoc fool you as it does a lot behind the scenes! Below is all you need in the DiceType.java file (including the code you need to replace in the comment)
public enum DiceType {
// TODO: your enum constants here
}
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
-
Enum Constant Details
-
D4
a 4 sided die -
D6
a 6 sided die -
D8
a 8 sided die -
D10
a 10 sided die -
D12
a 12 sided die -
D20
a 20 sided die
-
-
Constructor Details
-
DiceType
private DiceType()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-