Question: ************************************************************************************************************** (1).Modify your test program in b. above to prompt the user for the month and year to print (2).Output the calendar in an output

**************************************************************************************************************

(1).Modify your test program in b. above to prompt the user for the month and year to print

(2).Output the calendar in an output file.

The code provided has already met the a. , b. criteria focus on (1) and (2).

**************************************************************************************************************

 ************************************************************************************************************** (1).Modify your test program in b. above to prompt the

The code is provided below.

***************************Main.cpp**********************************

//preprocessor directives and header files #include "calendarType.h" #include "extDateType.h" #include "dateType.h" #include #include

//standard library using namespace std;

//const int to hold array size const int SIZE = 12;

//create a string array to hold the names of each month string mNames[SIZE] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

//Create getIntMonth definition int getIntMonth(string month) { for (int i = 0; i

//Void prototype for getInput void getInput(int &m, int&y) { //Display friendly user message and purpose of the alteration of the program cout > month >> y;

//While loop if month is invalid while(getIntMonth(month)==0) { cout > month; //month input } m = getIntMonth(month); //store the returned value into m }

//Commented out sections from assignments 2-5 // Leave local variables alone for month, day, year parameter purposes //Step into main int main() { //local variables int m, d, y; //int passed, remain; dateType date(0,0,0); //calling the constructors extDateType extDate(0,0,0); calendarType dayType(0,0,0);

//message explaining the purpose of the program to the user //cout

//prompt the user to enter the values //cout > m; //cout > d; //cout > y; //cout

d = 1;// set d to 1 as default getInput(m, y); //store month and year

//call the member functions dayType.setDate(m, d, y); //extDate.setDate(m, d, y); //date.setDate(m, d, y);

//check to make sure if it is a leap year //bool check = date.isLeapYear(y); //if (check) // cout

//display the chosen date in numerical form //date.printDate(); //extDate.setMonth(m,mNames,SIZE); dayType.setMonth(m,mNames,SIZE);

//display the date chosen in long form //extDate.printLongDate();

//call the rest of the member functions //date.numOfDays(m); //passed = date.numOfDaysPassed(m, d);//store the returned value into passed //remain = date.remainingDays(y);//store the returned value into remain

//display the amount of days passed //cout

//display the amount of days remaining //cout

//call the newDate function to calculate the new date //date.newDate(m, d, y, 25);

//display the new date by calling the printDate function //cout

//calculate the first day of the month dayType.firstDayOfMonth();

//display the months calendar dayType.printMonthCalendar();

return 0; }*************************DATETYPE.H****************************

#ifndef date_H #define date_H //begin class definition class dateType { public: void setDate(int month, int day, int year); //Function to set the date. //The member variables dMonth, dDay, and dYear are set //according to the parameters //Postcondition: dMonth = month; dDay = day; // dYear = year int getDay() const; //Function to return the day. //Postcondition: The value of dDay is returned. int getMonth() const; //Function to return the month. //Postcondition: The value of dMonth is returned. int getYear() const; //Function to return the year. //Postcondition: The value of dYear is returned. void printDate() const; //Function to output the date in the form mm-dd-yyyy. bool isLeapYear(int year); //Function to determine whether the year is a leap year. dateType(int month = 1, int day = 1, int year = 1900); //Constructor to set the date //The member variables dMonth, dDay, and dYear are set //according to the parameters //Postcondition: dMonth = month; dDay = day; // dYear = year //If no values are specified, the default values are //used to initialize the member variables. int numOfDays (int month); //function to count up the number of days int numOfDaysPassed (int month, int year); //function to count the number of days passed for the date chosen int remainingDays(int year); //function to count the number of days left remaining in the year int newDate(int month, int day, int year, int addDays); //function to create a new date by adding a fixed amount of days private: int dMonth; //variable to store the month int dDay; //variable to store the day int dYear; //variable to store the year int passedDays; //variable to store the days that have passed int noDays; //variable to store the # of days int daysRemaining; // variable to store the days left in a year }; #endif

******************extDateType.h*************************

#ifndef EXTDATETYPE_H_INCLUDED #define EXTDATETYPE_H_INCLUDED //preprocessor directives #include  #include "dateType.h" //standard library using namespace std; //begin the derived class class extDateType: public dateType { public: void setDate(int month, int day, int year); //function to set the date void setMonth(int month, string mNames[],const int SIZE); //function to set the name of the month void printLongDate(); //function to print out the name of the month with the days and year extDateType(int month = 1, int day = 1, int year = 1900); //constructor based on dateTypeImp.cpp private: int eMonth; //variable to store the month int eDay; //variable to store the day int eYear; //variable to store the year string eMonths; //variable to store the name of the month };//end the derived class #endif // EXTDATETYPE_H_INCLUDED

****************calendarType.h***********************

#ifndef CALENDARTYPE_H_INCLUDED #define CALENDARTYPE_H_INCLUDED //preprocessor directives #include  #include "dateType.h" #include "extDateType.h" //standard library using namespace std; //begin the derived class calendarType class calendarType: public dateType { public: void printMonthCalendar(); //function to print the calendar for the month chosen void setMonth(int month, string mNames[],const int SIZE); //function to set the month void setDate(int month, int day, int year); //function to set the date int firstDayOfMonth(); //function to find what day of the week the first day is int getMonth() const; //function to return the month. //postcondition: The value of cMonth is returned. int getYear() const; //function to return the year. //postcondition: The value of cYear is returned. calendarType(int month = 1, int day = 1, int year = 1500); //constructor based on dateTypeImp.cpp private: int firstDay;//variable to hold the value of the day of the week int cDay;//variable to store the day int cMonth;//variable to store month int cYear;//variable to store the year string cWeekDays;//variable to store the name of the day string cMonthNames;//variable to store the name of the month }; //end class header file #endif // CALENDARTYPE_H_INCLUDED

******************dateTypeImp.cpp***********************

//preprocessor directives and header files #include "dateType.h" #include  #include  using namespace std; //define the function newDate int dateType::newDate(int month, int day, int year, int addDays) { //add the current number of days to the fixed amount dDay = day + addDays; //see if the total number of days is > 31 if (dDay>31) { //make sure the day is not negative by finding the absolute value dDay = abs(dDay - 31); //increase the month if the number of days is > than 31 month++; } //store the value of the month into the variable dMonth dMonth = month; //check if the value of the variable month is > than 12 if (month>12) { //assign 1 to the variable dMonth dMonth = 1; //increment the variable dYear dYear++; } return 0; } //define the function numOfDaysPassed int dateType::numOfDaysPassed(int month, int day) { //declare local variables for a counter and for the passed days int i, passed = 0; //start the for loop from 1 to 12 for (i = 1; i = 1) dYear = year; else dYear = 1990; if (1  

*******************extDateTypeImp.cpp******************

//preprocessor directives and header files #include "extDateType.h" #include "dateType.h" #include  //standard library using namespace std; //define the function setDate void extDateType::setDate(int month, int day, int year) { if (year >= 1) eYear = year; else eYear = 1990; if (1  

**************calendarTypeImp.cpp**************

//preprocessor directives #include "calendarType.h" #include "extDateType.h" #include "dateType.h" #include  #include  #include  //standard library using namespace std; //define the function getMonth int calendarType::getMonth() const { return cMonth; } //define the function getYear int calendarType::getYear() const { return cYear; } //define the function setDate void calendarType::setDate(int month, int day, int year) { if (year >= 1) cYear = year; else cYear = 1990; if (1 cMonth;//assign the value in cMonth to month //using the this pointer int year = this->cYear;//assign the value in cYear to year //using the this pointer int day = 1; int y = year - (14 - month)/12; int m = month + 12 * ((14 - month) / 12) - 2; //this statement determines the firstDay by //modulus 7 to tell which day of the week in wDays is needed firstDay = (day + y + y / 4 - y / 100 + y / 400 + (31 * m / 12)) % 7; return firstDay; } //define the function printMonthCalendar void calendarType::printMonthCalendar() { //variable to hold the number of days in a specific month int numberOfDaysInMonth; //counter to make sure to watch how many days //have passed before a new week int dayOfWeekCounter = 0; cout  6)//statement to move to a new week { cout  Chapter 11 #10 page 815 Building upon the following previous Assignments Assignment 2 #2 page 812 . . . . Assignment 3 #6 and #7 pages 813-814 Assignment 4 #8 page 814 Assignment 5 #9 pages 814-815 Write the definitions of the member functions of the class calendarType (from Assignment 5) to implement the operations of the class calendarType. (25 points) Write a test program to print the calendar for either a particular month or a particular year. Use September 2019 as your sample test data. I will be testing using various months and years (including leap months and leap years) (25 points) a. b. Requirements Comments required throughout your header, implementation, and test files (20 points) Output a user-friendly message of the purpose of your program (5 points) . Your test program in b. above should only print the calendar of the tested month and year (25 points) o Do not include any other information on the console output (just the calendar) o Do not delete any of your code (block comment out) Hello! This program prints the calendar for a given month and year: May 2018 Sun MonTue Wed Thu Fri Sat 5 12 19 26 4 13 20 27 7 14 21 28 9 16 23 30 10 17 24 15 18 25 29

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!