Question: Programming Exercise #1: Die Class Write a Die class according to the UML Diagram. - Die sides int value: int + Die(numSides: int) roll()

Programming Exercise #1: Die Class Write a Die class according to the UML Diagram. - Die sides int value: intProgramming Exercise # 1. How much did you know about the topic before we started? 2. Have you changed any

Programming Exercise #1: Die Class Write a Die class according to the UML Diagram. - Die sides int value: int + Die(numSides: int) roll() : void + + getSides (): int + getValue(): int Specifications: roll() Simulates the rolling of the die. In the method create an object of the Random class. Generate a random number that is appropriate for the particular die. Hint: Use a method from the Random class that allows the number of sides to be passed as an argument. Observations: What does the Die know about itself? What can the Die do? Why are the setSides() and setValues() methods missing? Write a tester class that interacts with the Die class. Input: Ask the user for the number of sides of one die. For now, both die must have the same number of sides and it must be 6. Process: Create 2 Die objects. Call the constructors appropriately. Simulate rolling the die for each object. Output: Print appropriate messages to the user. Programming Exercise # 1. How much did you know about the topic before we started? 2. Have you changed any ideas you used to have on this topic? 3. What was especially satisfying to you about either the process or the finished product?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Based on the provided UML diagram and specifications you are tasked with creating a Die class that s... View full answer

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 Programming Questions!