Question: I need help working out this Homework Problem. The section Problem describes what I am asking: What I did was I created a project that

I need help working out this Homework Problem. The section Problem describes what I am asking:

I need help working out this Homework Problem. The section Problem describes

What I did was I created a project that had all three of the files in it as you see below. But what I am confused about is the part about "build the load module Problem1.exe then execute".

I am not sure what a .exe file is. Am I suppose to create another file that has the three of these files in it, and run it? Because when I do, I get errors. How am I suppose to execute the files?? I'll include the code for each of the files below. I would like an explanation on how to execute these files together.

Here is where I am so far:

what I am asking: What I did was I created a project

Files: Date.c

// Date.c

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

#include

#include

#include

#include ".Date.h"

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

void ConstructDATE(DATE *date)

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

{

(*date).MM = 2; date->DD = 3;

date->YYYY = 1954; date->epoch = 'A';

// Instrumentation

printf("Construction of DATE = "); OutputDATE(date,stdout); printf(" ");

}

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

void DestructDATE(DATE *date)

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

{

// Instrumentation

printf("Destruction of DATE = "); OutputDATE(date,stdout); printf(" ");

}

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

void InputDATE(DATE *date,FILE *IN)

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

{

fscanf(IN,"%d-%d-%d%c",&date->MM,&date->DD,&date->YYYY,&date->epoch);

}

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

void OutputDATE(const DATE *date,FILE *OUT)

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

{

// Use the format MM-DD-YYYYEE where EE = "AD" or "BC"

fprintf(OUT,"%2d-%2d-%4d%2s",date->MM,date->DD,date->YYYY,

(date->epoch == 'B') ? "BC" : "AD");

}

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

void SetMMDATE(DATE *date,const int MM)

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

{

date->MM = MM;

}

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

void SetDDDATE(DATE *date,const int DD)

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

{

date->DD = DD;

}

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

void SetYYYYDATE(DATE *date,const int YYYY)

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

{

date->YYYY = YYYY;

}

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

void SetEpochDATE(DATE *date,const char epoch)

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

{

date->epoch = epoch;

}

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

int GetMMDATE(const DATE *date)

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

{

return( date->MM );

}

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

int GetDDDATE(const DATE *date)

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

{

return( date->DD );

}

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

int GetYYYYDATE(const DATE *date)

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

{

return( date->YYYY );

}

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

char GetEpochDATE(const DATE *date)

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

{

return( date->epoch );

}

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

void ConvertToStringDATE(const DATE *date,char string[])

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

{

sprintf(string,"%2d-%2d-%4d%2s",date->MM,date->DD,date->YYYY,

(date->epoch == 'B') ? "BC" : "AD");

}

Files: Date.h

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

#ifndef DATE_H

#define DATE_H

//==============================================================

// Data model definitions

//==============================================================

typedef struct DATE

{

int MM;

int DD;

int YYYY;

char epoch;

} DATE;

//==============================================================

// Public member function prototypes

//==============================================================

void ConstructDATE(DATE *date);

void DestructDATE(DATE *date);

void InputDATE(DATE *date,FILE *IN);

void OutputDATE(const DATE *date,FILE *OUT);

void SetMMDATE(DATE *date,const int MM);

void SetDDDATE(DATE *date,const int DD);

void SetYYYYDATE(DATE *date,const int YYYY);

void SetEpochDATE(DATE *date,const char epoch);

int GetMMDATE(const DATE *date);

int GetDDDATE(const DATE *date);

int GetYYYYDATE(const DATE *date);

char GetEpochDATE(const DATE *date);

void ConvertToStringDATE(const DATE *date,char string[]);

//===============================================

// Private utility member function prototypes

//==============================================

//(none)

#endif

File Problem1.c

#include #include #include

#include ".Date.h"

int main () { char string[80+1];

DATE date1 = { 1,30,1979, 'A'};

DATE date2; ConstructDATE(&date2);

fprintf(stdout, " date1 = "); OutputDATE(&date1,stdout); fprintf(stdout, " ");

SetMMDATE(&date1,1); SetDDDATE(&date1,5); SetYYYYDATE(&date1, 1953); SetEpochDATE(&date1, 'A'); fprintf(stdout, " date1 = "); OutputDATE(&date1,stdout); fprintf(stdout, " ");

fprintf(stdout, " date2? "); InputDATE(&date2,stdin);

printf(" date2 = %2d/%2d/4%s ", date2.MM, GetDDDATE(&date2), GetYYYYDATE(&date2), (GetEpochDATE(&date2) == 'B') ? "BC" : "AD");

ConverToStringDATE(&date2,string); printf(" date2 = %s ",string); printf(" date2 = %s ",string);

DestructDATE(&date2); Destruct(&date1);

system("PAUSE"); return( 0 ); }

remainder of the program from the implementation (the details that are most likely to change). Written another way, information hiding is the ability to prevent certain aspects of a class or software component [like an ADT] from being accessible to its clients, using either programming language features (like private variables) or an explicit exporting policy, Taken from http://en.wikipedia.org/wiki Information hiding on August 3, 2013. Problem Create a project containing the three source files Date.c, Date.h, and Problem1.c, build the load module Probleml.exe, then execute Problem l.exe. Enter your birthdate (or some other "important-to-you" date) when prompted "date22 ". Submit your screenshot for credit. Sample Program Dialog EACOURSES CS1311\CodelADTs DATEVProblemlexe Construction of DATE = 2-3-1954AD date11-30-1979AD date1 = 1-5-1953AD date2? 7-17-19999 date2 7/12/1999AD date2 7-17-1999AD Destruction of DATE7-17-1999AD Destruction of DATE1 5-1953AD ress any key to continue..- omputational and Critical Thinking Questions (globals) Date.h Date.c Problem 1. #include #include #include Project Classes Debug 1 2 3 4 5 oblem Date.c Date.h Problem1.c #include ,' . \Date . h" 7 int main() 9char string[80+1]; 11 DATE date11,30,1979, 'A; 12 13 DATE date2; 14 ConstructDATE (&date2); 16 fprintf(stdout, "Indatel "); OutputDATE (&date1,stdout); fprintf(stdout, "In" 17 18

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!