Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having issue with my compiler in C++. Can someone compile this code which has Date.h, Date.cpp, and Problem.cpp please and post screenshot of it?

I'm having issue with my compiler in C++. Can someone compile this code which has Date.h, Date.cpp, and Problem.cpp please and post screenshot of it? Use the date of Halloween 10/31

Problem

Create the C++ project named Problem for the client application program Problem.cppthe project must contain the 3 files Dr. Hanna provided youDate.h, Date.cpp, and Problem.cppyou are not required to change my code in any way.

Test the Problem program with Halloween date (10/31). Please post screenshot which has a screenshot of your program dialog attached to prove youve correctly built the project.

//-------------------------------------------------

// Dr. Art Hanna

// Date.h

//-------------------------------------------------

#ifndef DATE_H

#define DATE_H

struct DATE

{

int MM;

int DD;

int YYYY;

};

void ConstructDate(DATE *date);

void DestructDate(DATE *date);

void InputDate(DATE *date);

void OutputDate(const DATE *date);

void SetDateMM(DATE *date,int MM);

void SetDateDD(DATE *date,int DD);

void SetDateYYYY(DATE *date,int YYYY);

int GetDateMM(const DATE *date);

int GetDateDD(const DATE *date);

int GetDateYYYY(const DATE *date);

#endif

//-------------------------------------------------

// Dr. Art Hanna

// Date.cpp

//-------------------------------------------------

#include

#include

#include

#include ".\Date.h"

using namespace std;

//-------------------------------------------------

void ConstructDate(DATE *date)

//-------------------------------------------------

{

date->DD = 12; date->MM = 1; date->YYYY = 1993;

cout << "Date construction of "; OutputDate(date); cout << endl;

}

//-------------------------------------------------

void DestructDate(DATE *date)

//-------------------------------------------------

{

cout << "Date destruction of "; OutputDate(date); cout << endl;

}

//-------------------------------------------------

void InputDate(DATE *date)

//-------------------------------------------------

{

cout << " MM? "; cin >> date->MM;

cout << " DD? "; cin >> date->DD;

cout << "YYYY? "; cin >> date->YYYY;

}

//-------------------------------------------------

void OutputDate(const DATE *date)

//-------------------------------------------------

{

// Use the format MM-DD-YYYY

cout << setw(2) << date->MM << "-" << setw(2) << date->DD << "-" << setw(4) << date->YYYY;

}

//-------------------------------------------------

void SetDateMM(DATE *date,int MM)

//-------------------------------------------------

{

date->MM = MM;

}

//-------------------------------------------------

void SetDateDD(DATE *date,int DD)

//-------------------------------------------------

{

date->DD = DD;

}

//-------------------------------------------------

void SetDateYYYY(DATE *date,int YYYY)

//-------------------------------------------------

{

date->YYYY = YYYY;

}

//-------------------------------------------------

int GetDateMM(const DATE *date)

//-------------------------------------------------

{

return( date->MM );

}

//-------------------------------------------------

int GetDateDD(const DATE *date)

//-------------------------------------------------

{

return( date->DD );

}

//-------------------------------------------------

int GetDateYYYY(const DATE *date)

//-------------------------------------------------

{

return( date->YYYY );

}

//-------------------------------------------------

// Dr. Art Hanna

// Chapter #3 Problem, Part 1

// Problem.cpp

//-------------------------------------------------

#include

#include

#include

#include ".\Date.h"

using namespace std;

//-------------------------------------------------

int main()

//-------------------------------------------------

{

DATE date1,date2;

ConstructDate(&date1);

ConstructDate(&date2);

SetDateMM(&date1,1);

SetDateDD(&date1,30);

SetDateYYYY(&date1,1979);

OutputDate(&date1); cout << endl;

cout << "date2? " << endl; InputDate(&date2);

// OMG! An example of the violation of the principle of information hiding!!!

cout << setw(2) << date2.MM << "/"

<< setw(2) << GetDateDD(&date2) << "/"

<< setw(4) << GetDateYYYY(&date2);

cout << endl;

DestructDate(&date2);

DestructDate(&date1);

system("PAUSE");

return( 0 );

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

=+impact member states and MNEs?

Answered: 1 week ago