Wrox Programmer Forums
|
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 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
 
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
 
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..
 
Old July 28th, 2011, 09:33 AM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
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!)





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





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