Download Object Oriented Programming - Programming Assignment 1 | COP 3330 and more Assignments Computer Science in PDF only on Docsity! Object Oriented Programming - Programming Assignment #1 Assigned: 1/19/06 (Thursday) Due: 2/2/06 (Thursday) at 11:55pm WebCT time Objective 1. Use basic Java input and output statements. 2. Review the if statement and loops from COP 3223. 3. Learn how to use a few key Java classes. Problem: Simple Slot Machine Write a program that allows the user to play a simplified version of a slot machine. The user starts with $10. At the beginning of the program the user is given the following choices: 1) Play the slot machine. 2) Cash out. Each play costs 25 cents. For each play, the slot machine will output a random three-digit number, where each digit ranges from 0 to 9. (This can be done by generating three separate integers in between 0 and 9, inclusive.) The result of playing the slot machine should be outputted along with what the user won. Here is a chart to indicate the winners earnings: Combination Winnings 2 of a kind (such as 676 or 112) 50 cents 3 of a kind (000, 111, ..., 999) $10.00 (Thus technically, you make a net earnings of 25 cents if you get a 2 of a kind and a net earnings of $9.75 when you get 3 of a kind.) If a player runs out of money, automatically cash them out and tell them that they have no money left. (Thus, a player, after losing who has 0 cents left should not be prompted with the menu at all. Rather, they should simply be presented with a message to end the game.) Otherwise, when a player chooses to cash out, thank them for playing and output how much money they have left. Input Specification 1. The choice entered by the user for the menu will always be valid. Output Sample Here are two sample outputs of running the program. Note that this test is NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given. The user input is given in italics while the program output is in bold. Sample Run A Welcome to the slot machine! You have $10.00. Choose one of the following menu options: 1) Play the slot machine. 2) Cash out. 1 The slot machine shows 046. Sorry you don't win anything. You have $9.75. Choose one of the following menu options: 1) Play the slot machine. 2) Cash out. 1 The slot machine shows 933. You win 50 cents! You have $10.00. Choose one of the following menu options: 1) Play the slot machine. 2) Cash out. 1 The slot machine shows 444. You win the big prize, $10.00! You have $19.75. Choose one of the following menu options: 1) Play the slot machine. 2) Cash out. 2 Thank you for playing! You end with $19.75!