|
-
Nov 11th, 2005, 11:43 AM
#1
Thread Starter
New Member
hey guys.. help plz
hey guys help me with this problem please
Problem DateChecker
Write a use case diagram and a C# console program called DateCheck that determines whether a calendar date is valid. For example, the date 30-02-2006 (in the form DD-MM-YYYY) is not correct because there will only be 28 days in February, 2006. Your program will accept a day and month and a year from the user and report to the user whether that date is valid.
Assistance:
• A year is a leap year if:
o the year is divisible by 400, OR…
o the year is divisible by 4 AND the year is NOT divisible by 100
Tips:
• The trick to solving this problem is to break the problem into pieces and solve each piece, one at a time. For example, you could add the following features to your program one at a time and test each one before adding the next one.
o Display a title using an Intro() method
o Obtain a single date from the user using an InputDate() method
o Verify the year only by adding a ValidYear() method and display message like ”That date is okay!” or “That date does NOT exist” for the user.
o Add month verification using ValidMonth().
o Add day of month verification using ValidDayr() assuming that February ALWAYS has 28 days.
o Now modify ValidDay() to handle leap years too using the algorithm provided under “Assistance”.! Note that if you never get to this step you’ll only lose 2 marks on the project!
Your program must be modular making use of methods in the following way:
• A method called Intro() that has NO return value and merely displays the title.
• A method called InputDate() that is called from your Main method and that will obtain and return the day, month and year entered by the user
• A method called ValidYear() that returns a value that indicates whether the year is valid. For this program assume that any 4-digit year is acceptable (1000 to 9999 inclusive) and all other values are not.
• A method called ValidMonth() that returns a value that indicates whether the month is valid. Of course a valid month can be any integer in the range of 1 to 12 inclusive.
• A method called ValidDay() that returns a value that indicates whether the day is valid. The day must be ≥ 1 and ≤the maximum day for that month. Note that the months January (01), March (03), May (05), July (07), August (08), October (10) and December (12) each have 31 days. April (04), June (06), September (09) and November (11) each have 30 days. February (02) usually has 28 days except in leap years when it has 29 days. For full marks this method should use a ‘switch’ statement!
• You must incorporate at least one method (it could be one of the above) that passes its parameters by reference!
**** Plz of the experts in here to help me with sucha probelm, i no oit might be something big to do, but plz do it for me, and i'll aporeciable , and thx alot guys***
Last edited by m7md; Nov 12th, 2005 at 08:05 PM.
-
Nov 12th, 2005, 11:15 PM
#2
Re: hey guys.. help plz
This should be in the C# Forum, the codebank is for finished or nearly finished code that might be usefull to others.
Bill
-
Nov 13th, 2005, 01:00 AM
#3
Re: hey guys.. help plz
Moved
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 13th, 2005, 03:37 AM
#4
Re: hey guys.. help plz
The general consensus around here is that people should only be helped with assignments if they are having specific issues with parts of there code or they are stuck as to how to proceed with something specific. You've just posted your assignment instructions and that's it. No effort on your part means no help from us. Make a start and then post the code that you're having trouble with if you run into problems, but we're not going to do your homework for you.
-
Nov 13th, 2005, 11:45 PM
#5
Re: hey guys.. help plz
The assignment details are a load of rubbish. Validating a date should be a short simple function, not a whole lot of one liners that they have described above.
Your program must be modular making use of methods
What they describe is 'functional' not modular and in any case you cannot do pure functional programming in C# - C# is a completely OO language. I suppose that they want you to chuck all methods into one class, but even a class seems like too much overhead for such a simple task.
Stating that for full marks you should use a switch() statement is ridiculous - the best way involves as little branching as possible and you should be marked only on the effectiveness and efficiency of your method, not what constructs you use. In any case validating the number of days in a month can be achieved purely mathematically - there is absolutely no need for a switch() construct.
You must incorporate at least one method (it could be one of the above) that passes its parameters by reference!
Why? What a pointless requirement.
The whole thing stinks, homework or no homework.
Anyway, m7md - do you know any C#? If so at least make an attempt at this, and we'll help if you get stuck. If not, I suggest you go back to your textbooks and have a think about how to tackle it... we can't teach you from scratch
-
Nov 13th, 2005, 11:54 PM
#6
Re: hey guys.. help plz
Like a great many teaching exercises, this one is pretty pointless in many ways. This could all be done in a couple of lines using the Calendar class, but then what would be the teaching value? I'm sure it's just to show that you understand and can put to use various concepts code structures, rather than to really create anything useful.
-
Nov 14th, 2005, 12:01 AM
#7
Re: hey guys.. help plz
Yeah true - well the next exercise should be: make your code as short as possible by REMOVING the constructs... then you'll really be programming
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|