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

Forgot to ask for coding in c++ last time Design a class to print a monthly cale

ID: 3806201 • Letter: F

Question

Forgot to ask for coding in c++ last time

Design a class to print a monthly calendar given a month and a year. Use a dayType object to hold the first day of the month, use an extendedDateType object with the day set to 1 to store the month and year. Note that these objects are attributes of a calendar object and are hidden from a user of the calendar class. Use the following CRC specification to develop this class:

please give all code in c++

Test the calendar class by writing a program which uses a loop to produce output similar to the following:

   September 2017
    Sun    Mon    Tue    Wed    Thu    Fri    Sat
                                         1      2
      3      4      5      6      7      8      9
     10     11     12     13     14     15     16
     17     18     19     20     21     22     23
     24     25     26     27     28     29     30

Class: calendarType Super Classes: Sub Classes: Description: Prints a calendar for a specified month and year Responsibilities: Collaborations: Initialize and set the month and year extendedDateType Initialize and set the first day of the month (For example, April 1, 2016 starts on a Friday). Assume that you can print a calendar for any month starting January 1, 1500 and note that January 1, 1500 is a Monday). dayType Print the calendar. Note that extendedDateType can provide the label for the calendar and the number of days in the month). Also dayType can provide the first day of the week for the current month and year. extendedDateType, dayType

Explanation / Answer

#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;
int main ()

{
int year,month,firstday,leapsum, days;





cout<<"Please enter the number of the month and year to access calendar "<<endl;

cout<< "Please leave a space in between the month and year when you enter them: ";

cin>>month>>year;

firstday=(((year-1)*365)+4*((year-1)/4)-4*((year-1)/100)+4*((year-1)/400)+1)%7;

leapsum=(!(year%4)&&(year%100))||!(year%400);

day

system("cls");



switch (month)
{case 1:
month;
{if (leapsum=0)
days=31;
else
days=31;}
cout<<"January"<<" "<<firstday<<" "<<year;
break;

case 2:
month;
{if (leapsum=0)
days=29;
else
days=28;}
cout<<"February"<<" "<<firstday<<" "<<year;
break;

case 3:
month;
{if (leapsum=0)
days=31;
else
days=31;}
cout<<"March"<<" "<<firstday<<" "<<year;
break;
case 4:
month;
{if (leapsum=0)
days=30;
else
days=30;}
cout<<"April"<<" "<<firstday<<" "<<year;
break;

case 5:
month;
{if (leapsum=0)
days=31;
else
days=31;}
cout<<"May"<<" "<<firstday<<" "<<year;
break;

case 6:
month;
{if (leapsum=0)
days=30;
else
days=30;}
cout<<"June"<<" "<<firstday<<" "<<year;
break;

case 7:
month;
{if (leapsum=0)
days=31;
else
days=31;}
cout<<"July"<<" "<<firstday<<" "<<year;
break;

case 8:
month;
{if (leapsum=0)
days=31;
else
days=31;}
cout<<"August"<<" "<<firstday<<" "<<year;
break;

case 9:
month;
{if (leapsum=0)
days=30;
else
days=30;}
cout<<"September"<<" "<<firstday<<" "<<year;
break;

case 10:
month;
{if (leapsum=0)
days=31;
else
days=31;}
cout<<"October"<<" "<<firstday<<" "<<year;
break;

case 11:
month;
{if (leapsum=0)
days=30;
else
days=30;}
cout<<"November"<<" "<<firstday<<" "<<year;
break;

case 12:
{if (leapsum=0)
days=31;
else
days=31;}
month;
cout<<"December"<<" "<<firstday<<" "<<year;
break;

default:
cout<<"Please restart program and enter correct month and year";
}



return 0;

}

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