Question: c# Using visual studio Your task is to create a Die' class, which will allow for the rolling of a single die, which can have

c# Using visual studio

c# Using visual studio Your task is to create a Die' class,which will allow for the rolling of a single die, which can

Your task is to create a Die' class, which will allow for the rolling of a single die, which can have a variable number of sides, and the number of sides is passed to the die on onstruction e ' face that is currently showing on the dice The Die' class must have 2 constructors: public Die() Die' class should have two private attributes. One which stores the number of faces (numFaces), and one which stores the current face value of the dice (face Value) i.e. the his constructor creates an instance of Die with the default number of faces, which is 6 The face value should be set to the default face value, which is 1. public Die(int faces) is constructor creates an instance of Die with a specific number of faces. If 'faces' is less than the minimum number of faces (3), the default number of faces is instantiated (6). The face value should be set to the default face value (). class must also have three other methods to represent common behaviours of a die public void RollDie() This method must roll the die and store the value resulting from the roll internally - i.e. the new face value. Hint- the Random class will be helpful here. public int GetFaceValue() his method should be used to get the current face value of the die public int GetNumFaces) This method should be used to get the number of faces of the die ow, given the defaults, the code Die myDie = new Die ( ) ; should create a single six-sided die, with a face value of 1. ie myDie - new Die(10);, however, should create a 10-sided Die. Rolling this die should produce values between 1 and 10. ote that no Main() function is provided. You should create your own Main() function for debugging your new class. Your Die class will be instantiated and its methods called by e AMS in order to test it. If you stll have difficulties, here are some tips when writing programs for AMS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!