TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Khoi
NA
18
0
Input month - Get days
Nov 5 2009 11:16 AM
I'd like to code a program which user can input a month, then the program shows a number of days. Below is my code, but it shows an error "
Class, struct, or interface method must have a return type
". Please advise
class GetDays
{
string Month = 0;
public GetNumOfDay()
{
switch (Month)
{
case January: case March: case May: case July: case December:
Console.WriteLine("This month has 31 days {0}",Month);
break;
case April: case June: case September: case November:
Console.WriteLine("This month has 30 days {0}", Month);
break;
case Febuary:
if (Month / 400 != 0)
{
Console.WriteLine("This month has 28 days {0}", Month);
}
else Console.WriteLine("This month has 29 days {0}", Month);
default:
Console.WriteLine("Invalid month");
}
}
}
class Program
{
static void Main(string[] args)
{
GetDays obj = new GetDays();
obj.GetNumOfDay();
Console.ReadLine();
}
}
Reply
Answers (
4
)
Can someone help me with this C#
How do i capture the cell that cuases Optimistic Concurrecny!