C++
Date.cpp
Date.cpp
#include
"Date.h"
#include
<
iostream
>
using
namespace
std
;
//DATE CLASS DEFINITION
Date
::
Date
(
int
m
,
int
d
,
int
y
)
//constructor
:
month
(
m
),
day
(
d
),
year
(
y
)
//initialization list
{
}
void
Date
::
display
()
{
cout
<<
month
<<
'/'
<<
day
<<
'/'
<<
year
<<
endl
;
}
Date.h
#ifndef DATE_H #define DATE_H //DATE CLASS DECLARATION class Date { public: Date(int m, int d, int y); //constructor void display(); private: int month; int day; int year; }; #endif
Time.cpp
Time.cpp
#include
"Time.h"
#include
<
iostream
>
#include
<
iomanip
>
using
namespace
std
;
Time
::
Time
(
int
h
,
int
m
)
//constructor
:
hour
(
h
),
minute
(
m
)
//initialization list
{
}
void
Time
::
display
()
{
cout
<<
hour
<<
':'
<<
setw
(
2
)
<<
setfill
(
'0'
)
<<
minute
<<
endl
;
setfill
(
' '
);
}
Time.h
#ifndef TIME_H #define TIME_H //TIME CLASS DECLARATION class Time { public: Time(int h, int m); //constructor void display(); private: int hour; int minute; }; #endif
lab16.cpp
lab16.cpp
//Do not modify this file
#include
"Date.h"
#include
"Time.h"
#include
"Report.h"
int
main
()
{
Report
r
(
7
,
4
,
1776
,
10
,
15
,
"Founding fathers take a coffee break."
);
r
.
display
();
}