C# program coding
For undergraduate students in COP4983.703, the output in console of ass1.cs must display the following three lines of message:
Today is Monday, August 28, 2019
EXAM 1 is scheduled on Monday, October 07, 2019
There are 39.27 days before EXAM 1.
C# CODE:
using System; class MainClass { public static void Main (string[] args) { //Get current date DateTime todayDate = DateTime.Now; Console.WriteLine("Today is " + todayDate.ToString("dddd, dd MMMM yyyy")); //Set EXAM 1 date DateTime examDate = new DateTime(2019, 10, 07); Console.WriteLine("EXAM 1 is schedule on " + examDate.ToString("dddd, dd MMMM yyyy")); //Calculate number of days left in EXAM 1 from today's date double daysLeft = (examDate - todayDate).TotalDays; //Round off to 2 decimal places daysLeft = Math.Round(daysLeft, 2); Console.WriteLine("There are " + Convert.ToString(daysLeft) + " days before EXAM 1."); } }
OUTPUT:
Get Answers For Free
Most questions answered within 1 hours.