 |
BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3
 | This is the forum to discuss the Wrox book Beginning C# 3.0 : An Introduction to Object Oriented Programming by Jack Purdum; ISBN: 9780470261293 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

September 11th, 2008, 04:27 PM
|
Friend of Wrox
|
|
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
|
|
Monitoring
I will try to visit this site at least once a week if not more often. If I can be of help, just let me know.
Dr. Purdum
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
|

September 20th, 2008, 06:24 AM
|
Registered User
|
|
Join Date: Aug 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello Dr. Purdum. In the summary of Chapter 3 you say that you've excluded the char value type from this chapter even
though it is a value type and postponed discussing it
until Chapter 6. But there is now further discussion about char data type in the book?
|

October 19th, 2008, 11:44 AM
|
Friend of Wrox
|
|
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
|
|
Oops...my bad. There is some discussion of the char type starting on p. 181. I think part of the reason I forgot about it is that I rarely have need for using a char. I think this is because most of the programming I do uses Unicode rather than ASCII for character data. Because Unicode uses 16 bits for each character, it's pretty common to use an int for character storage.
If you are having a particular problem, please submit it and I'll see if I can help.
Dr. Purdum
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
|

October 27th, 2008, 11:48 AM
|
Registered User
|
|
Join Date: Aug 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think there's a mistake in code for clsCardDeck. In methods code when you validate index variable in the if statement( if (value > 0 & & value < = deck.Length)) shouldn't it be value < deck.Length ? Because value cannot be deck.Length simply because last card in the deck is at index deck.Length-1
|

November 11th, 2008, 10:15 AM
|
Friend of Wrox
|
|
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
|
|
I'm pretty sure the code is correct. If you are referring to the if statement near the bottom of page 251, you can understand why it has to be less than or equal to (<=) by looking at the initialization of the pips[] array near the top of the same page. Note that the first element of the array is an empty string. I did that so the indexes don't have to be offset by 1 each time they are used. That is, an index of 1 is the Ace of Spades ("AS"). This scheme allows me to use the modulo operator to figure out what card I'm looking at. If you read the narrative leading up to the code again, I think you'll see what I mean.
Dr. Purdum
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
|

November 14th, 2008, 01:17 PM
|
Registered User
|
|
Join Date: Aug 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I definitely insist that it's wrong. deck.Length evaluates in 53 and pips[] array's length is 53, last element of this array has index of 52, thus you can't reference 53th element of pips[] array.
|

November 15th, 2008, 11:17 AM
|
Friend of Wrox
|
|
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
|
|
I misread your comment...my bad. I also went to the code on my system, which should be the same as in the book, and the comparison is only the less than comparison. The correction is as you stated and only the less than sign should be used.
Dr. Purdum
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
|

November 22nd, 2008, 01:50 PM
|
Registered User
|
|
Join Date: Aug 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
In listing 10-9 where you add two additional methods to clsCardDeck class, I think they(methods) need a little bit correction namely: In the if statement of getOneCard() method, 1 should be subtracted from nextCard and then checked against DECKSIZE((nextCard-1) <= DECKSIZE); similarly in the index of deck array(deck[nextCard-1]).It is because otherwise you don't deal the very first card in deck array since nextCard has value 2 after nextCard++ statement;I think you'll understand what I mean. Thanks in advance
|

November 25th, 2008, 06:37 AM
|
Friend of Wrox
|
|
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
|
|
You are correct that the first card is never dealt, but that is by design, so the code is correct. Look at Listing 10-6. Note that the first element in the pips[] array is empty. I did this so I could use the modulus operator to figure out which card I'm looking at. (The text explains this in detail.) Also, note that the size of the array is set to DECKSIZE + 1 for the same reason. The first element of both arrays is ignored.
Dr. Purdum
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
|
|
 |