Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old September 11th, 2008, 04:27 PM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default 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)
  #2 (permalink)  
Old September 20th, 2008, 06:24 AM
Registered User
 
Join Date: Aug 2008
Location: Tbilisi, , Georgia.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?

  #3 (permalink)  
Old October 19th, 2008, 11:44 AM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

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)
  #4 (permalink)  
Old October 27th, 2008, 11:48 AM
Registered User
 
Join Date: Aug 2008
Location: Tbilisi, , Georgia.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #5 (permalink)  
Old November 11th, 2008, 10:15 AM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

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)
  #6 (permalink)  
Old November 14th, 2008, 01:17 PM
Registered User
 
Join Date: Aug 2008
Location: Tbilisi, , Georgia.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

  #7 (permalink)  
Old November 15th, 2008, 11:17 AM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

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)
  #8 (permalink)  
Old November 22nd, 2008, 01:50 PM
Registered User
 
Join Date: Aug 2008
Location: Tbilisi, , Georgia.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #9 (permalink)  
Old November 25th, 2008, 06:37 AM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

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)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Monitoring URL Dhananjay prajapati Visual Basic 2005 Basics 1 March 1st, 2007 06:34 PM
I'm still monitoring this forum... .MAttButler BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 0 September 26th, 2006 10:50 PM
Monitoring gangeles VB.NET 0 May 22nd, 2006 09:38 AM
COM+ Monitoring using COMSVCSLib bappelt VB Components 2 August 1st, 2005 10:39 AM
Monitoring files rylemer Pro VB 6 5 June 20th, 2003 10:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.