Question: 2. Using the Die class defined in Chpter 4, write a class called PairOfDice, composed of two Die objects. Include methods to set and get

2. Using the Die class defined in Chpter 4, write a class called PairOfDice, composed of two Die objects. Include methods to set and get the individual die values, a method to roll the dice, and a method that returns the current sum of the two die values. Create a driver class called RollingDice2 to instantiate and use a PairOfDice object. (30 Marks) [hint: you need to have three classes, Die, PairOfDice and RollingDice2, the PairOfDice will use Die class and RollingDice2 which is the driver class of your program will use PairOfDice class] 3. 3.1. Write a program that generates a random double base (b) and height (h) for a triangle in the range 5 to 10 , inclusive, and then computes the area of the triangle and shows it with three decimal points. (15 marks) 3.2. Ask the user to input a base and height for a second triangle in range of 10 to 20 and then print the ratio of the area of the first triangle to this new triangle in percentage with correct formatting
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
