In: Computer Science
I need this in C# please.
Exercise #2: Design and implement a programming (name it NextMeeting) to determine the day of your next meeting from today. The program reads from the user an integer value representing today’s day (assume 0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, etc…) and another integer value representing the number of days to the meeting day. The program determines and prints out the meeting day. Format the outputs following the sample runs below.
Sample run 1:
Today is Monday
Days to the meeting is 10 days
Meeting day is Thursday
Sample run 2:
Today is Wednesday
Days to the meeting is 7 days
Meeting day is Wednesday
Sample run 3:
Today is Friday
Days to the meeting is 20 days
Meeting day is Thursday
using System;
namespace ConsoleApplication1
{
class NextMeeting
{
static void Main(string[] args)
{
// string array for days of week
string[] days = { "Sunday","Monday",
"Tuesday","Wednesday","Thursday","Friday","Saturday" };
int today, meetingDay;
// ASk user to enter today and meeting day
Console.Write("Enter today's day [assume 0 for Sunday, 1 for
Monday..]: ");
today = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number of days to the meeting day: ");
meetingDay = Convert.ToInt32(Console.ReadLine());
// Calculate result day, if it's value is >=7, round it
int result = today + meetingDay;
if (result >= 7)
{
result = result % 7;
}
// Get day of week and print the result
string meetingDayOfWeek = days[result];
Console.WriteLine("\nToday is "+days[today]);
Console.WriteLine("Days to the meeting is "+meetingDay+"
days.");
Console.WriteLine("Meeting day is "+meetingDayOfWeek);
}
}
}
OUTPUT