Outlab 3: Petals Around the Rose

Due: Friday 26 February at 6 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.

Assignment

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 Friday 26 February at 6 pm, submit the files Driver.java and PetalsGame.java into the appropriate D2L dropbox folder. DO NOT SUBMIT .class files!

Grading - 20 points