Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to write this program using Visual Studios C# and the I want to use

ID: 3687374 • Letter: I

Question

I am trying to write this program using Visual Studios C# and the I want to use Months, days,as data types but I am confused to where to get started and what other two data types I can use. Write a generic method that accepts three parameters of the same type and displays them in order. For numeric data, "in order" means in numerical order. For other classes, you can define "in order" appropriately. Test the method using at least four different data types, including at least one for which you implement a CompareTo() method.

Explanation / Answer

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

             

            /* If you want to use this file to tell someone happy birthday,

             * all you must do is change the "OPEN THIS...", the birthDay value,

             * and the names, telling who's birthday it is and who it is from.

             */

        {

            // The Information at the top of the Console

            Console.WriteLine("O P E N   T H I S   P R O G R A M   2 0 1 2");

            Console.WriteLine("===========================================");

            

            //The Variables and Data Types

            DateTime rightNow = DateTime.Now.Date;

            DateTime birthDay = DateTime.Parse("01/28/2012");

            TimeSpan daysLeft = birthDay.Subtract(DateTime.Now);

            //If Today is his birthday

            if (rightNow == birthDay)

            {

                Console.WriteLine("Happy Birthday Papa! From: name");

                Console.WriteLine("======================================");

                Console.ReadLine();

            }

                // If his bithday has already passed

            else if (rightNow > birthDay)

            {

                Console.WriteLine("Sorry, but this program is valid for this year only. This program is no longer of any use, you may delete it.");

                Console.ReadLine();

            }

                //If his birthday hasn't quite made it here yet

            else

            {

                Console.WriteLine("Sorry, but you must wait " + daysLeft.Days + " days, then open this file. ");

                Console.WriteLine("It is currently: " + DateTime.Now);

                Console.ReadLine();

            }

        }

    }

}

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

             

            /* If you want to use this file to tell someone happy birthday,

             * all you must do is change the "OPEN THIS...", the birthDay value,

             * and the names, telling who's birthday it is and who it is from.

             */

        {

            // The Information at the top of the Console

            Console.WriteLine("O P E N   T H I S   P R O G R A M   2 0 1 2");

            Console.WriteLine("===========================================");

            

            //The Variables and Data Types

            DateTime rightNow = DateTime.Now.Date;

            DateTime birthDay = DateTime.Parse("01/28/2012");

            TimeSpan daysLeft = birthDay.Subtract(DateTime.Now);

            //If Today is his birthday

            if (rightNow == birthDay)

            {

                Console.WriteLine("Happy Birthday Papa! From: name");

                Console.WriteLine("======================================");

                Console.ReadLine();

            }

                // If his bithday has already passed

            else if (rightNow > birthDay)

            {

                Console.WriteLine("Sorry, but this program is valid for this year only. This program is no longer of any use, you may delete it.");

                Console.ReadLine();

            }

                //If his birthday hasn't quite made it here yet

            else

            {

                Console.WriteLine("Sorry, but you must wait " + daysLeft.Days + " days, then open this file. ");

                Console.WriteLine("It is currently: " + DateTime.Now);

                Console.ReadLine();

            }

        }

    }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote