Question: how to do coding using kotlin Die.kt Write a class (Die.kt) that closely replicates dice: - Properties to describe the die - Type - or

how to do coding using kotlin
Die.kt Write a class (Die.kt) that closely replicates dice: - Properties to describe the die - Type - or name, or colour (eg d20) - Number of sides (eg 20) - Current side up - A primary constructor that can accept 0,1, or two arguments Default typeame: "d6"; default number of sides: 6; random side up generated fror - Number of sides is the parameter. Default typeame: "d\{number of sides } " random - Both the number of sides and the type are parameters; random side up generated - Appropriate accessors and mutators - Things to consider: - Should you let the user change the number of sides? - If you can change the number of sides, should you also change the typeame? A roll method to generate a random valuehs - Your roll method can make use of built-in random functions like Random.nextInt(). - roll is a special set method that doesn't take any arguments and shouldn't return a DiceGame.kt Write a runner class (DiceGame.kt) to test your Die class: - Create different sized dice using each constructor - Roll the dice and display their results (before and after) - Choose one Die object and set it to show it's highest value - Create 5 six-sided dice. Roll each Die in a loop until you get 5 of a kind. Count and display Time Commitment This lab should take approximately 2 hours
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
