Starting from:
$30

$27

CMSC 203, Assignment 2

CMSC 203, Assignment 2



Concepts Utilized in this Project

Java fundamentals
Selection & looping structures
Random number generations
Creation of an interactive program
Simulating a real world object


Overview

A slot machine, a gambling device, allows users to insert money (as bets) into the device and then pull its lever which will generate (and display) an output of a set of images. During a pull, if there is a match in two or more images, the use wins an amount that is equal to or greater than the bet that was placed.

For this project, a set of words will be generated (instead of a set of images) whenever the device’s lever is pulled in order to simplify the complexity of coding.

You have been tasked to create a Java program to simulate the slot machine.

Specifications & Requirements

Whenever the program is running, it should:
• prompt for a betting amount from an user
o Each bet should be in an amount between $1 and $20.
• randomly generate (and display) four words from the following list to simulate the pulling of a lever (a bet):
o Cherry, Orange, Plum, Bell, Melon, Bar, Lucky 7 (representing their corresponding images)
o Here are some examples:
 Cherry, Bell, Bar, Luck 7 (0 match)
 Cherry, Cherry, Bar, Luck 7 (1 match, pair of cherries)
 Cherry, Cherry, Cherry, Luck 7 (three cherries in a row)
 Cherry, Cherry, Cherry, Cherry (perfect match, four in a row)

• If there is no match, inform user that they have lost their bet.
• For each exact match (of a pair of words), inform user that they have won an amount that is equal to their bet
o It is possible that a pull would result in 2 pairs of words (Cherry, Cherry, Bar, Bar)
• If three of the words match (three in a row,) inform user that they have won three times the amount of their bet
• If four of the words match (a perfect match,) inform user that they have won eight times the amount of their bet
o A $1,000 bonus will be added if four Lucky 7 are matched (grand prize)
• Allow user to place bets as long as they wish to
• Continuously display the (running) total amount of money entered into the slot machine and the total amount won



Deliverables / Submissions:

In addition to completing the Java application, a write-up is required. Be sure to review the provided project rubric. At a minimal, the write-up should include:
• Pseudo-code in English showing the steps to solve the problem
o It must be detailed enough for someone else to write the code based on this algorithm
o Complete this step first, then write your code
• Test Cases
o Prepare a test table with a list of test cases (expected versus actual results) that you are testing the application with
o Same expectations as Assignment 1
• Any assumptions that you are making for this project
• In three or more paragraphs, highlight your learning experience

Each student must submit two compressed files in the zip format (.zip files) to the assignment’s folder on Blackboard for this project with the following contents:

1. LastNameFirstName_Assignment2_Complete.zip (a compressed file) containing the following:
o Write up (Word document)
o src [directory]
 File1.java (example)
 File2.java (example)
2. LastNameFirstName_Assignment2_Moss.zip, a compressed file containing one or more Java files:
o File1.java (example)
o File2.java (example)
o This folder should contain Java source files only





NAME__________________________

Assignment 2 Grading Sheet


EXTERNAL DOCUMENTATION 24 (total)
CheckList for Assignment 2 is included and completed 1 pt _____
Algorithm Design
List ordered steps in English in to solve the problem 8 pts _____
(detailed enough for someone else to write the code based on this algorithm)
Test Cases
Proper Format (Inputs, Expected Output, Runs Correctly) 2 pts _____
4 test cases with valid data (unique input data for each case) 6 pts _____
Assumptions (if any) 2 pts _____
Lessons Learned 5 pt _____
In 3+ paragraphs, highlight your lessons learned and learning experience from working on this project. How did you do? What have you learned? What did you struggle with? How will you approach your next project differently?

PROGRAMMING 76 (total)
Programming Style
Consistent indentation is used 4 pts _____
Appropriate identifiers are used 4 pts _____
Internal class documentation (within source code)
Description of what class does 6 pts _____
Author’s Name 2 pts _____
Appropriate comments within each section of the code 8 pts _____
Java file compiles and runs 14 pts _____
Accurate output from additional test cases 20 pts _____
Program user interface
Clear to user how data is to be entered 4 pts _____
Output is easy to understand 4 pts _____
Data Validation (between 1 and 20) 4 pts _____
Program Details
• Remind the user the amount bet must be greater
between 1 and 20 2 pts _____
• Prints application header 2 pts _____
• Display the (running) total amount of money entered into the
slot machine and the total amount won 2 pts _____


TOTAL POINTS _____ / 100
Comments:

More products