Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4.12 Lab: Complete the Die class Below you will find an unfinished version of the Die class. This class models a single die with any
4.12 Lab: Complete the Die class Below you will find an unfinished version of the Die class. This class models a single die with any number of sides A die as two fields . value . sides A die has the following methods roll- rolls the die by generating a random number. Value is set to the generated number. .getValue returns the current value of the die set by roll . setSides - sets the number of sides of the die getSides-returns the number of The Die class is in a file named Die java Edit the main class (Main.java) to create a roll a 6-sided die and a 20-sided die Follow the instructions in the comments to complete the class LAB 4.12.1: Lab: Complete the Die class 0/3 ACTIVITY Current file. Main.java Load default template... 1 public class Main f 2 public static void main(String] args) f 4 //Create two Die using the Die varaibles declared below Die d6; Die d20; 10 //set the sides of d6 to 6, and d20 to 20 //roll both die 12 13 14 15 16 17 18 19 20 21 //the result is printed System.out.println("The 6-sided rolled a "d6.getValue)); System.out.println("The 12-sided rolled a"d20.getValue))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started