Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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: 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
Step: 1
Based on the provided UML diagram and specifications you are tasked with creating a Die class that s...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