Private Member Functions The functions declared private above, is Leap, daysPerMonth, name, number, are helper functions - member functions that will never be needed by a user of the class, and so do not belong to the public interface (which is why they are "private"). They are, however, needed by the interface functions (public member functions), which use them to test the validity of arguments and construct valid dates. For example, the constructor that passes in the month as a string will call the number function to assign a value to the unsigned member variable month. isLeap: The rule for whether a year is a leap year is: • (year % 4 == 0) implies leap year • except (year % 100 == 0) implies NOT leap year • except (year % 400 == 0) implies leap year So, for instance, year 2000 is a leap year, but 1900 is NOT a leap year. Years 2004, 2008, 2012, 2016, etc. are all leap years. Years 2005, 2006, 2007, 2009, 2010, etc. are NOT leap years. Output Specifications Read the specifications for the print function carefully. The only cout statements within your Date member functions should be: 1. the "Invalid Date" warnings in the constructors 2. in your two print functions Required Main Function You must use this main function and global function getDate as they are here. You may not change these functions at all. Copy-and-paste these into your main.cpp file and then add the Date class. Date getDate(); int main() { } Date test Date; test Date = getDate(); cout << endl; cout << "Numeric: "; testDate.printNumeric (); cout << endl; cout << "Alpha: "; testDate.printAlpha (); cout << endl; return 0; Date getDate() { int choice; unsigned monthNumber, day, year; string monthName; cout << "Which Date constructor? (Enter 1, 2, or 3)" << endl << "1 Month Number" << endl << "2 Month Name" << endl << "3 default" << endl; cin >> choice; cout << endl;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

There's additional code that's required. I have attached the instructions below. It's continuous. 

Private Member Functions
The functions declared private above, is Leap, daysPerMonth, name, number, are helper functions - member functions
that will never be needed by a user of the class, and so do not belong to the public interface (which is why they are "private").
They are, however, needed by the interface functions (public member functions), which use them to test the validity of
arguments and construct valid dates. For example, the constructor that passes in the month as a string will call the number
function to assign a value to the unsigned member variable month.
is Leap: The rule for whether a year is a leap year is:
.
(year % 4 == 0) implies leap year
●
except (year % 100 == 0) implies NOT leap year
• except (year % 400 == 0) implies leap year
So, for instance, year 2000 is a leap year, but 1900 is NOT a leap year. Years 2004, 2008, 2012, 2016, etc. are all leap years.
Years 2005, 2006, 2007, 2009, 2010, etc. are NOT leap years.
Output Specifications
Read the specifications for the print function carefully. The only cout statements within your Date member functions
should be:
1. the "Invalid Date" warnings in the constructors
2. in your two print functions
Required Main Function
You must use this main function and global function getDate as they are here. You may not change these functions at all.
Copy-and-paste these into your main.cpp file and then add the Date class.
Date getDate();
int main() {
}
Date test Date;
test Date = getDate();
cout << endl;
cout << "Numeric: ";
testDate.print Numeric ();
cout << endl;
cout << "Alpha: ";
testDate.printAlpha ();
cout << endl;
return 0;
Date getDate() {
int choice;
unsigned monthNumber, day, year;
string monthName;
cout << "Which Date constructor? (Enter 1, 2, or 3)" << endl
<< "1
Month Number" << endl
<< "2
Month Name" << endl
<< "3 default" << endl;
cin >> choice;
cout << endl;
Transcribed Image Text:Private Member Functions The functions declared private above, is Leap, daysPerMonth, name, number, are helper functions - member functions that will never be needed by a user of the class, and so do not belong to the public interface (which is why they are "private"). They are, however, needed by the interface functions (public member functions), which use them to test the validity of arguments and construct valid dates. For example, the constructor that passes in the month as a string will call the number function to assign a value to the unsigned member variable month. is Leap: The rule for whether a year is a leap year is: . (year % 4 == 0) implies leap year ● except (year % 100 == 0) implies NOT leap year • except (year % 400 == 0) implies leap year So, for instance, year 2000 is a leap year, but 1900 is NOT a leap year. Years 2004, 2008, 2012, 2016, etc. are all leap years. Years 2005, 2006, 2007, 2009, 2010, etc. are NOT leap years. Output Specifications Read the specifications for the print function carefully. The only cout statements within your Date member functions should be: 1. the "Invalid Date" warnings in the constructors 2. in your two print functions Required Main Function You must use this main function and global function getDate as they are here. You may not change these functions at all. Copy-and-paste these into your main.cpp file and then add the Date class. Date getDate(); int main() { } Date test Date; test Date = getDate(); cout << endl; cout << "Numeric: "; testDate.print Numeric (); cout << endl; cout << "Alpha: "; testDate.printAlpha (); cout << endl; return 0; Date getDate() { int choice; unsigned monthNumber, day, year; string monthName; cout << "Which Date constructor? (Enter 1, 2, or 3)" << endl << "1 Month Number" << endl << "2 Month Name" << endl << "3 default" << endl; cin >> choice; cout << endl;
/* Outputs to the console (cout) a Date exactly in the format "3/1/2012".
Does not output a newline at the end.
};
*/
void printNumeric () const;
/* Outputs to the console (cout) a Date exactly in the format "March 1, 2012".
The first letter of the month name is upper case, and the month name is
printed in full - January, not Jan, jan, or january.
Does not output a newline at the end.
*/
void printAlpha () const;
private:
/* Returns true if the year passed in is a leap year, otherwise returns false.
*/
bool isLeap (unsigned y) const;
/* Returns number of days allowed in a given month
e.g. daysPerMonth (9, 2000) returns 30.
Calculates February's days for leap and non-leap years,
thus, the reason year is also a parameter.
=/
-
unsigned daysPerMonth (unsigned m, unsigned y) const;
/* Returns the name of a given month
- e.g. name (12) returns the string "December"
*/
string name (unsigned m) const;
/* Returns the number of a given named month
- e.g. number ("March") returns 3.
*/
unsigned number (const string &mn) const;
Note: Placing the error messages into the constructors like the above is not necessarily a good way to handle constructor errors, but until you
learn about exceptions, it's the best we can do.
Transcribed Image Text:/* Outputs to the console (cout) a Date exactly in the format "3/1/2012". Does not output a newline at the end. }; */ void printNumeric () const; /* Outputs to the console (cout) a Date exactly in the format "March 1, 2012". The first letter of the month name is upper case, and the month name is printed in full - January, not Jan, jan, or january. Does not output a newline at the end. */ void printAlpha () const; private: /* Returns true if the year passed in is a leap year, otherwise returns false. */ bool isLeap (unsigned y) const; /* Returns number of days allowed in a given month e.g. daysPerMonth (9, 2000) returns 30. Calculates February's days for leap and non-leap years, thus, the reason year is also a parameter. =/ - unsigned daysPerMonth (unsigned m, unsigned y) const; /* Returns the name of a given month - e.g. name (12) returns the string "December" */ string name (unsigned m) const; /* Returns the number of a given named month - e.g. number ("March") returns 3. */ unsigned number (const string &mn) const; Note: Placing the error messages into the constructors like the above is not necessarily a good way to handle constructor errors, but until you learn about exceptions, it's the best we can do.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps

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

Can you please explain this part again? 

Date::Date :day(1),month(1),year(2000)

{

 

}

Is it written this way? I am a little confused about how to write this portion at the start in the Date.cpp file, can you please rewrite this part more clearly? 

Step 3
program:
Date.cpp
#include <iostream>
#include <string>
#include "Date.h"
using namespace std;
Date::Date()
:day(1),month(1),year(2000)
{
}
Transcribed Image Text:Step 3 program: Date.cpp #include <iostream> #include <string> #include "Date.h" using namespace std; Date::Date() :day(1),month(1),year(2000) { }
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education