Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in c++. IMPORTANT: Code in c++. Implementation of Class function should be in the cpp file. header(.h) file should only contain function headers. You

Code in c++.

IMPORTANT: Code in c++. Implementation of Class function should be in the cpp file. header(.h) file should only contain function headers. You have to make .cpp and .h files for for all the classes and make necessary changes in makefile

Task:

Code in c++.

This question requires you to write code to manipulate dates and perform date arithmetic. Design your application using the following two classes:

class Date{

public:

Date(); // initialize attributes with default values

Date(int,int,int);// if invalid, set default date or set equal to system date

Date(const Date&);

bool inputDate(); /* assign values to Date attributes (cin from user),

return true if valid range of values are input */

bool copyDate(Date&);

bool inputCompleteDate(int,int,int);

Date& getDate() const;

void retrieveDate(int& , int& , int&) const; // retrieve Date attribute values

void showDate() const; // Display Date attribute values

bool isEqual(Date&); // return true if both dates are equal

bool isLeapYear();

// All other relevant methods go here, setter/getter etc

private:

bool validateDate(); // Validate attribute range values methods can also be private

int day;

int month;

int year;

};

________________________________________

class DateCalculator{

public:

int daysBetween(Date& , Date& ); // return days elapsed between two Dates classical example of association

bool isEarlier(Date& D1, Date& D2); /* return true if D1 is earlier

or same as D2 otherwise return false */

// All other relevant methods go here

private:

// All relevant attributes go here

};

The main functional requirements are as follows:

  • The program must prompt the user to input two dates in mm dd yyyy format
  • The program must validate the dates to make sure it conforms to normal range of values
  • The program must verify that the first date is chronologically earlier (or the same as) the second date
  • If the above two items are satisfied, the program must compute and display the number of days elapsed between the two dates. Your program must accommodate leap years.

Following should be implemented:

  • Deep copy.
  • Copy constructor
  • Dectructor
  • Function overriding
  • Initializer List
  • Deleting pointers
  • Display() and setter/getter
  • Make a menu driven code.
  • Do not use strings. User char pointers instead

Code in c++.

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

Step: 3

blur-text-image

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions

Question

Explain the factors influencing wage and salary administration.

Answered: 1 week ago

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago