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

Your program should have 4 functions. isLeapYear should be a bool value-returnin

ID: 3615456 • Letter: Y

Question

Your program should have 4 functions.

isLeapYear should be a bool value-returningfunction that determines whether the year, passed by a valueparameter is a leap year

getDate is a void function that prompts fordate input, checks that the entered date is in the correct formatand has valid numbers, passes the day month and year back usingreference parameters

dayNumber is a void function with valueparameters to pass the day month and year, and a referenceparameter to pass back the calculated day number

outputDay is a void function that outputs theoriginal date and the day number, using value parameters to passthe date and day number information

Write a program that prints the day number of the year, giventhe date in the form month-day-year. For example, if the input is1-1-2006, the day is 1; if the input is 12-25-2006 the day is 359.The program should check for a leap year. A leap year if it isdivisible by 4, but not by 100. For example, 1992 & 2008 aredivisible by 100 is a leap year if it is also divisible by 400. Forexample, 1600 and 200 are divisible by 400. However, 1800 is not aleap year because 1800 is not divisible by 400.

#include <iostream>

using namespace std;

bool isLeapYear (int year);

int main ()

{

int day, month, year;

int dayNumber;

char ch;

     cout << "Program that prints theday number: " ;

    

     cout << " Please enter a date(mm-dd-yyyy): " ;

     cin >> month;

     cin >> day ;

     cin >> year;

     cin >> ch ;   

dayNumber = 0;

while (month > 1)

{

      // all numbers come after

switch (month 1)

{

       

         case 2:

            dayNumber = 28;

            

        if (isLeapYear (year))

          dayNumber++;

          break;

          

        case 4:

        case 6:

        case 9:

        case 11:

            dayNumber = 30;

            break;

       

          case 1 :

        case 3 :

        case 5 :

        case 7 :

        case 8 :

        case 10:

        case 12:

            

            dayNumber = 31;

            break;

            

     

      

}

month--;

}

dayNumber = day;

          cout<< "The day number is: " << dayNumber;

         

         system("PAUSE");

          return0;

         

          }

         

bool isLeapYear (int year)

{

    

     if (isLeapYear / =4) &&(isLeapYear !/ = 100) ||

    

   (isLeapYear / =100 ) && (isLeapYear / =400)

    

     return true;

    

     return false;

    

    }

Explanation / Answer

please rate - thanks Hope you don't mind, I debugged the program and broke it intofunctions as required #include using namespace std; bool isLeapYear (int year); void getDate(int&,int&,int&); void dayNumber(int,int,int,int&); void outputDay(int,int,int,int); int main () { int day, month, year; int dayOfYear; cout month;      cin>>ch;      cin >> day ;      cin>>ch;      cin >> year; } void dayNumber(int month,int day,int year,int& dayOfYear) {dayOfYear = 0; while (month > 1) {       // all numbers come after switch (month) {          case 2:             dayOfYear += 28;         if (isLeapYear (year))           dayOfYear++;           break;                case 4:         case 6:         case 9:         case 11:             dayOfYear += 30;             break;               case 1:         case 3 :         case 5 :         case 7 :         case 8 :         case 10:         case 12:            dayOfYear += 31;            break; } month--; } dayOfYear+= day; } void outputDay(int month,int day,int year,int dayOfYear) {cout