# Outlab 3: Petals Around the Rose

Due: Monday 18 July at 10 pm

## Purpose

Gain experience with decision statements, reading/using user input, and generating random numbers.

## Partners

This is an individual assignment, though collaboration (not solution sharing) is allowed.

## Problem Statement

Petals Around the Rose is a puzzle that asks you to determine the "number of petals around the rose", given five dice. Read about the problem here and here. Play the simulator in the link until you understand how the game works and can guess correctly every time. In this assignment, you will be building your own Petals simulator that rolls dice (generates random numbers for die values: 1-6). You will also ask the user what their guess for the number of petals is and compare their answer to the correct answer.

• Create an Outlab3 project and type this code into a class called Driver.
• Carefully review the Driver, as it contains clues about the structure of the rest of the program.
• Supply the missing PetalsGame class as well as the methods that the Driver indicates you need.
• If your implementation is correct, your output should look similar to this. Your output won't be identical, since it depends on user menu selections and the random die values.
• DO NOT PROCEED FURTHER UNTIL YOU HAVE THE ABOVE WORKING PERFECTLY!
• Once everything above is working perfectly, modify the Driver so that the user has a third menu option, 3. Guess. If this option is selected, the user should be presented the dice values and then prompted for a guess. This guess should then be checked for correctness and an appropriate message printed. Appropriate output for this section would be this.

## Hints

1. Before you write code, write down (pencil and paper) the equation for calculating to correct number of petals for ONE die (can you translate what you wrote to a Java method?).
2. Your first task is to get the PetalsGame working with the Driver as is, do not modify the Driver for this first step.
3. Work one method at a time: Is rollDice() working correctly? Now is printDice() working correctly?...
4. Think carefully about what methods you need. You may want methods in the PetalsGame class that I have not told you about.
5. Once you are ready to start handling user input (after the "DO NOT PROCEED" step above), you do not need to modify PetalsGame anymore.

## Submission

By Monday 18 July at 10:00 pm, submit the files Driver.java and PetalsGame.java into the appropriate D2L dropbox folder. DO NOT SUBMIT .class files!