The pieces of code you will need:
- Console.Write
- Console.ReadLine
int.Parse
(to convert the input to an integer)
DateTime.Today
DateTime.AddDays(zeroOrMoreDays)
DateTime.DayOfWeek
(if you want Wednesday
instead of 10/19/2011 12:00:00 AM
)
Here is some pseudo-code:
Ask the user for the number of days (as a string)
Parse numberOfDays into an int
for i = 0 to numberOfDays:
write line: today.AddDays(i).DayOfWeek
You'll also need to do some tricks to get the natural language stuff to work, e.g. three days after tomorrow is
.
I'd use a few extra if i == 0
else if i == 1
type statements to solve this, and fall back on a general <number> days after tomorrow
after a certain point.
See this (closed) question for links on how to get that number: converting numbers in to words C#
Edit due to your comments on the question
@ sblom ... nope for a web service i'm planning
Don't use Console
stuff then.
Make this a method instead, and don't do the string/int.Parse
stuff. Just take an int
directly.
Build a result with a StringBuilder
, and return a string
, rather than printing out the result directly.