In: Computer Science
PLEASE DO THIS IN C#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
SOURCE CODE:
*Please follow the comments to better understand the code.
**Please look at the Screenshot below and use this code to copy-paste.
***The code in the below screenshot is neatly indented for better understanding.
using System;
public class GFG{
// function to convert number to string weekday
static string getDayStr(int day)
{
string dayStr;
switch(day)
{
case 0:
dayStr="Sunday";
break;
case 1:
dayStr="Monday";
break;
case 2:
dayStr="Tuesday";
break;
case 3:
dayStr="Wednesday";
break;
case 4:
dayStr="Thursday";
break;
case 5:
dayStr="Friday";
break;
case 6:
dayStr="Saturday";
break;
default:
dayStr="-1";
break;
}
return dayStr;
}
// test the program
static public void Main ()
{
// read data
int today = Convert.ToInt32(Console.ReadLine());
int next = Convert.ToInt32(Console.ReadLine());
// is it valid??
if(today>6 || today<0)
Console.WriteLine("Invalid
day");
else
{
// calculate next weekday
int nextDay=(next+today)%7;
// write the output
Console.WriteLine("Today is "+getDayStr(today));
Console.WriteLine("Days to meeting is "+(next));
Console.WriteLine("Meeting day is
"+getDayStr(nextDay));
}
}
}
========
SCREENSHOT:
OUTPUTS: