In this chapter, the class dateType was designed to implement the date in a program, but the member function setDate and the constructor do not check whether the date is valid before storing the date in the member variables. Rewrite the definitions of the function setDate and the constructor so that the values for the month. day, and year are checked before storing the date into the member variables. Add a member function. isLeap Year. to check whether a year is a leap year. Moreover, write a test program to test your class. Input should be format month day year with each separated by a space. Output should resemble the following: Date #: month-day-year An example of the program is shown below: Date 1: 3-15-2008 this is a leap year If the year is a leap year, print the date and a message indicating it is a leap year, otherwise print a message indicating that it is not a leap year. The header file for the class dateType has been provided for you. Grading When you have completed your program, click the Submit button to record

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Programming Exercise 11-2

dateType.h file provided
 
#ifndef date_H 
#define date_H
 
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();
      //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.

private:
    int dMonth;      //variable to store the month
    int dDay;        //variable to store the day
    int dYear;       //variable to store the year
};

#endif
Instructions
In this chapter, the class dateType was designed to implement the date in
a program, but the member function setDate and the constructor do not
check whether the date is valid before storing the date in the member
variables. Rewrite the definitions of the function setDate and the
constructor so that the values for the month, day, and year are checked before
storing the date into the member variables. Add a member function.
isLeapYear. to check whether a year is a leap year. Moreover, write a test
program to test your class.
Input should be format month day year with each separated by a space.
Output should resemble the following:
Date #: month-day-year
An example of the program is shown below:
Date 1: 3-15-2008
this is a leap year
If the year is a leap year, print the date and a message indicating it is a leap
year, otherwise print a message indicating that it is not a leap year.
The header file for the class dateType has been provided for you.
Grading
When you have completed your program, click the Submit button to record
your score.
Transcribed Image Text:Instructions In this chapter, the class dateType was designed to implement the date in a program, but the member function setDate and the constructor do not check whether the date is valid before storing the date in the member variables. Rewrite the definitions of the function setDate and the constructor so that the values for the month, day, and year are checked before storing the date into the member variables. Add a member function. isLeapYear. to check whether a year is a leap year. Moreover, write a test program to test your class. Input should be format month day year with each separated by a space. Output should resemble the following: Date #: month-day-year An example of the program is shown below: Date 1: 3-15-2008 this is a leap year If the year is a leap year, print the date and a message indicating it is a leap year, otherwise print a message indicating that it is not a leap year. The header file for the class dateType has been provided for you. Grading When you have completed your program, click the Submit button to record your score.
Tasks
Date is validated correctly
>
Transcribed Image Text:Tasks Date is validated correctly >
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I also am struggling with this project but do not understand this code. The problem I have uses a main.cpp file alongside a dateTypelmp.cpp file. This solution does not solve the task as I understand it to be.

The class dateType was designed to implement the date in a program, but the member function setDate and the constructor do not check whether the date is valid before storing the date in the member variables.

Function setDate and the constructor need to be rewrit so that the values for the month, day, and year are checked before storing the date into the member variables. A member function should be included, isLeapYear, to check whether a year is a leap year.

Input should be format month day year with each separated by a space. Output should resemble the following:

Date #: month-day-year

If the year is a leap year, print the date and a message indicating it is a leap year, otherwise print a message indicating that it is not a leap year.

The header file for the class dateType has been provided.

Solution
Bartleby Expert
SEE SOLUTION
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY