What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » C# Programming Help

Pages: (2): « First [ 1 ] 2 » Last »
C# Programming Help
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. C# Programming Help
My friend is having trouble with an assignment and I don't know enough of C# to help her.

code:
using System;

namespace DateChecker
{
    class Class1
    {
        [STAThread]
        static void Main(string[] args)
        {
            class Introduction
            {
                static void Intro()
                {
                    Console.WriteLine("Welcome to the DateChecker Program!");
                    Console.WriteLine("***********************************");
                }
                class Input_Day
                {
                    static void ValidDay(out string InputDay)
                    {
                        InputDay = "Please enter the day of the month (DD): ";
                        int sUserDay = Int32.Parse(Console.ReadLine());
                    }
                    class Input_Month
                    {
                        static void ValidMonth(out string InputMonth)
                        {
                            InputMonth = "Please enter the month (MM): ";
                            int sUserMonth = Int32.Parse(Console.ReadLine());
                        }
                        class Input_Year
                        {
                            static void ValidYear(out string InputYear)
                            {
                                InputYear = "Please enter the year (YYYY): ";
                                int sUserYear = Int32.Parse(Console.ReadLine());
                            }
                           
                        }
                        switch(Input_Month)
                        {
                            case 0:
                            case 2:
                            case 4:
                            case 6:
                            case 7:
                            case 9:
                            case 11:
                           
                                sUserDay = case 0,2,4,6,7,9,11 <= 31;     
                                //If it has 31 days in the month
                                      break;
                            case 3:
                            case 5:
                            case 8:
                            case 10:
                                sUserDay = case 3,5,8,10 <= 30;
                                //If it has 30 days in the month
                                      break;
                            default:
                                sUserDay = default <= 28;
                                       break;
                        }

                }
            }
        }

    }
}

Here are the errors she gets

[Image: attachment.php?pid=564773]

The program is supposed to allow the user to enter day then month then year (numerically) and the program is to decide if it is a valid date taking into consideration leap years.

Any help is appreciated.

.jpg File Attachment: errors.JPG (37.97 KB)
This file has been downloaded 318 time(s).

This post was edited on 11-14-2005 at 12:33 AM by matty.
11-14-2005 12:31 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: C# Programming Help
bump

Here is a text file of the code so its easier to read.

.txt File Attachment: datechecker.txt (1.49 KB)
This file has been downloaded 193 time(s).
11-14-2005 01:54 AM
Profile E-Mail PM Find Quote Report
^_^
Full Member
***

Avatar
ayy caramba!

Posts: 151
Reputation: 10
Joined: Apr 2003
RE: C# Programming Help
Remember that you need to close all the { that you open, try to change the = thing for a ==  ... what program are you using? i use Dev c++ 4.9 and im quite good at it
11-14-2005 02:02 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: C# Programming Help
quote:
Originally posted by ^_^
Remember that you need to close all the { that you open, try to change the = thing for a ==  ... what program are you using? i use Dev c++ 4.9 and im quite good at it
Each } is closed properly and == doesn't work. I tried working on it in VisualStudio.Net (Which is what she uses).
11-14-2005 02:05 AM
Profile E-Mail PM Find Quote Report
brian
Senior Member
****

Avatar

Posts: 819
Reputation: 43
– / Male / –
Joined: Sep 2004
RE: C# Programming Help
Missing } at end?
11-14-2005 02:37 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: C# Programming Help
quote:
Originally posted by nvez
Missing } at end?
No for some reason if you remove the code including class introduction then its fine with no errors.
11-14-2005 02:42 AM
Profile E-Mail PM Find Quote Report
brian
Senior Member
****

Avatar

Posts: 819
Reputation: 43
– / Male / –
Joined: Sep 2004
RE: C# Programming Help
It's something with the namespace part..

Try: namespace DateChecker;

she? :o

* brian runs
11-14-2005 02:57 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: C# Programming Help
quote:
Originally posted by nvez
It's something with the namespace part..

Try: namespace DateChecker;

she? :o

* nvez runs
Nope produces more errors.
11-14-2005 03:08 AM
Profile E-Mail PM Find Quote Report
brian
Senior Member
****

Avatar

Posts: 819
Reputation: 43
– / Male / –
Joined: Sep 2004
RE: C# Programming Help
What about removing the { .. } after namespace DateChecker ?

Mehish, tbh C++ is easier for such stuff.
11-14-2005 03:10 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: C# Programming Help
quote:
Originally posted by nvez
What about removing the { .. } after namespace DateChecker ?

Mehish, tbh C++ is easier for such stuff.
Nope still recieving errors. Saying its missing {
11-14-2005 03:29 AM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On