
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

COP 3330: Alternate Homework # Program #1: Video Game Mania Billy loves video games! In fact, he spends all of his money on them. He has a weekly allowance and each game costs a certain amount of money. (Both of these are values entered by the user.) You will write a program to simulate Billy's spending habits for a particular number of weeks, also a value entered by the user. At the end of each week, determine whether or not Billy buys a video game. Also, any money not spent on a video game carries over to the following week. You are also guaranteed that his allowance is a positive integer number of dollars but is less than the price of one game, which is also an integer. At the end of your program, you write out how much money Billy has left and how many video games he has bought. Write a program that executes this program. A sample run of the program is included below (Program output is in bold, the user input is in italics): Please enter Billy's weekly allowance in dollars. 10 Please enter the cost of a video game in dollars. 33 Please enter the number of weeks to follow Billy's spending habits. 8 After week 1, Billy has 10 dollars and does not buy a video game. After week 2, Billy has 20 dollars and does not buy a video game. After week 3, Billy has 30 dollars and does not buy a video game. After week 4, Billy has 40 dollars and then buys a video game! After week 5, Billy has 17 dollars and does not buy a video game. After week 6, Billy has 27 dollars and does not buy a video game. After week 7, Billy has 37 dollars and then buys a video game! After week 8, Billy has 14 dollars and does not buy a video game. At the end of 8 weeks, Billy has 14 dollars and 2 video games. Call your program Game.java. In your comments at the end of the program, explain any problems you had in creating the program and how you caught and fixed the mistakes. Only do this for the most important issues you dealt with.