Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do Not allow your lines to be longer than the line of = characters. ======================================================================== 1. Problems observed in play Without the Debugger (I found

image text in transcribed

image text in transcribed

image text in transcribed

Do Not allow your lines to be longer than the line of "=" characters. ======================================================================== 1. Problems observed in play Without the Debugger (I found 3)

======================================================================== 2. Problems seen in memory using the Debugger (I found 9) Specify the line number and what is wrong with the memory value 1. Line:

======================================================================== 3. Problems fixed: Line number and new code ======================================================================== 4. What was the hardest part of this lab for you and why was it hard?

One hand or game is played as follows. First, the user chooses an amount to bet before any cards are dealt. Then the dealer deals a face down card to the player and itself, then a face up card to the player and itself. The program will display all these values to the user EXCEPT the dealer's face down card which will be displayed at an X. The user is then allowed to ask for more cards until the sum of the user's cards values is >21(which means the user "busted"), or the user declines another card(which means the user "stands). If the user didn't bust, then the dealer deals itself cards face up until the dealer's score is >= 17, showing each card to the user. The user wins the hand if she/he did not bust and either the dealer busted or the user's card values summed to a value greater than the dealer's sum. The dealer wins the hand if the user busted or if neither busted and the dealer's cards sum to a value that is higher than the user's sum. If neither busted and the sums are the same, we will call the hand a draw. The program will keep track of the net winnings/losings by updating a variable after each hand. It will also keep track of the number of wins, losses, and ties and report these to the user. The program currently has a number of bugs in it and does not do these things correctly. Depending on how you count them, there are either 7 or 9 errors, precisely. If you run the program, you should see a number of errors in what it produces as output. Because of the way random is initialized the first cards dealt should be: 6, 6, Jack, 9, Ace, 10, 8, 3, 4, 4, 4, Jack, 9, 3, 5, Ace, 6, 7, 9, Queen. Knowing that should help. You will get the same cards in the same order every time you play. Your task for the day is to use the debugging features in NetBeans (setting breakpoints, examining variables) to discover as many of the bugs in the code as you can. Open The DebuggingLabWriteUp.txt in Notepad (Do NOT use Word). And fill it in as you follow these instructions. 1. Run the program without the debugger. Just to see what happens. Make a note of each thing that you see that is wrong, but don't fix anything yet. Short succinct statements please. 1 2. Run the program through the debugger. (Debug ->Step into.) If you don't see a tab labeled Variables down where the output Console is go to Window ->Debugging ->Variables to open it. Most of your variables are properties so they will be listed under "this You will go back and forth between the two tabs to enter input, see output (Console) and then watch variable values (Variables). Try to play two hands and write down as many problems as you can find by just watch- ing values and knowing what they should be. Don't try to fix anything yet. Number the problems you find, For example: 1. line 176 value of netUserWinnings is 0, should be 100 2. line 97 value of netUserWinnings is 0, should be 100 3. Once you've done that, find the place where you are certain that there is a problem and fix it. Make a note of the fix. Where you see the problem in memory is not necessarily where you will fix it. For example if the original line of code was this: while (input 10); you might write: line 127 while (input 10); Identify the problem each thing fixes (some may fix more than one problem). If the problem you fixed will correct 1 and 2 from the previous part, just type 3. Once you've done that, find the place where you are certain that there is a problem and fix it. Make a note of the fix. Where you see the problem in memory is not necessarily where you will fix it. For example if the original line of code was this: while (input 10); you might write: line 127 while (input 10); Identify the problem each thing fixes (some may fix more than one problem). If the problem you fixed will correct 1 and 2 from the previous part, just type #1 & #2 Line: 220 added i+= 5 Make sure that you find fixes for all of the problems you found in part 2. One hand or game is played as follows. First, the user chooses an amount to bet before any cards are dealt. Then the dealer deals a face down card to the player and itself, then a face up card to the player and itself. The program will display all these values to the user EXCEPT the dealer's face down card which will be displayed at an X. The user is then allowed to ask for more cards until the sum of the user's cards values is >21(which means the user "busted"), or the user declines another card(which means the user "stands). If the user didn't bust, then the dealer deals itself cards face up until the dealer's score is >= 17, showing each card to the user. The user wins the hand if she/he did not bust and either the dealer busted or the user's card values summed to a value greater than the dealer's sum. The dealer wins the hand if the user busted or if neither busted and the dealer's cards sum to a value that is higher than the user's sum. If neither busted and the sums are the same, we will call the hand a draw. The program will keep track of the net winnings/losings by updating a variable after each hand. It will also keep track of the number of wins, losses, and ties and report these to the user. The program currently has a number of bugs in it and does not do these things correctly. Depending on how you count them, there are either 7 or 9 errors, precisely. If you run the program, you should see a number of errors in what it produces as output. Because of the way random is initialized the first cards dealt should be: 6, 6, Jack, 9, Ace, 10, 8, 3, 4, 4, 4, Jack, 9, 3, 5, Ace, 6, 7, 9, Queen. Knowing that should help. You will get the same cards in the same order every time you play. Your task for the day is to use the debugging features in NetBeans (setting breakpoints, examining variables) to discover as many of the bugs in the code as you can. Open The DebuggingLabWriteUp.txt in Notepad (Do NOT use Word). And fill it in as you follow these instructions. 1. Run the program without the debugger. Just to see what happens. Make a note of each thing that you see that is wrong, but don't fix anything yet. Short succinct statements please. 1 2. Run the program through the debugger. (Debug ->Step into.) If you don't see a tab labeled Variables down where the output Console is go to Window ->Debugging ->Variables to open it. Most of your variables are properties so they will be listed under "this You will go back and forth between the two tabs to enter input, see output (Console) and then watch variable values (Variables). Try to play two hands and write down as many problems as you can find by just watch- ing values and knowing what they should be. Don't try to fix anything yet. Number the problems you find, For example: 1. line 176 value of netUserWinnings is 0, should be 100 2. line 97 value of netUserWinnings is 0, should be 100 3. Once you've done that, find the place where you are certain that there is a problem and fix it. Make a note of the fix. Where you see the problem in memory is not necessarily where you will fix it. For example if the original line of code was this: while (input 10); you might write: line 127 while (input 10); Identify the problem each thing fixes (some may fix more than one problem). If the problem you fixed will correct 1 and 2 from the previous part, just type 3. Once you've done that, find the place where you are certain that there is a problem and fix it. Make a note of the fix. Where you see the problem in memory is not necessarily where you will fix it. For example if the original line of code was this: while (input 10); you might write: line 127 while (input 10); Identify the problem each thing fixes (some may fix more than one problem). If the problem you fixed will correct 1 and 2 from the previous part, just type #1 & #2 Line: 220 added i+= 5 Make sure that you find fixes for all of the problems you found in part 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

fscanf retums a special value EOF that stands for...

Answered: 1 week ago

Question

What does the start( ) method defined by Thread do?

Answered: 1 week ago