Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer by Rod Stephens; ISBN: 9780470596906
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 28th, 2011, 12:18 AM
Registered User
 
Join Date: Jan 2011
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post
Exclamation Ex 15-2

Hi Rod,
I am a novice programmer and I am trying to find out how I can do Ex 15-2 in C# Programming with Visual Studio 2010 24 hour trainer with both array and loop. I would love for anyone to solve this with a loop and array as i am having some difficulties in resolving this issue
  #2 (permalink)  
Old July 28th, 2011, 12:21 AM
Registered User
 
Join Date: Jan 2011
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post
Default

Forgot to add here. The information I am specifically looking for is how I can enter the information about the 10 birthdates in listbox (as shown in Ex15-1 for one value) instead of hard coded values (as you have shown for Ex15-2) and I want to see it using both loops and arrays.

Last edited by domino; July 28th, 2011 at 12:43 AM..
  #3 (permalink)  
Old July 28th, 2011, 09:33 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

A good question! Here's what I would do:

1. Get a birth date. Have the user enter a date in a TextBox and click a Go button.

2. Parse the date to create a Date variable. Use its Year, Month, and Day properties to get its year month and day.

3. Clear the ListBox. Then for (int i = 0; i <= 10; i++):

a. Create a new Date variable using the Year + i, Month, and Day.

b. Display the new Date and its DayOfWeek.ToString() in the ListBox.

I think you can do everything here except the loop with what you know by Lesson 15. Loops are covered in Lesson 19. (I suppose you could do this with a series of 11 nearly identical statements instead of using a loop but it would be poor code.)

Give that a try and let me know if you get stuck. If you want to see an example, email me and I'll send one to you.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 15 - ciwluke BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 11th, 2008 03:33 PM
listing 15-15 pg(568) DyerOppenheimer BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 February 13th, 2008 01:41 PM
Page 15 crackass BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 December 19th, 2004 02:31 PM
Chapter 15!! studentinpain BOOK: Beginning ASP 3.0 16 March 12th, 2004 10:26 AM
CH.15 NEED HELP stacy BOOK: Beginning ASP 3.0 1 January 21st, 2004 03:37 AM



All times are GMT -4. The time now is 10:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.