Question
In C++ PLEASE COMPLETE the missing implementations in Date.cpp , BlogEntry.cpp, and Text.cpp Date.cpp: #include Date.h Date::Date() { } Date::Date(int day, int month, int year)
In C++
PLEASE COMPLETE the missing implementations in Date.cpp , BlogEntry.cpp, and Text.cpp
Date.cpp: #include "Date.h"
Date::Date() { }
Date::Date(int day, int month, int year) throw (logic_error) { }
int Date::getDay() const { return -1; }
int Date::getMonth() const { return -1; }
int Date::getYear() const { return -1; }
//in show2.cpp //void showStructure() const;
bool Date::isLeapYear(int year) { return false; }
int Date::daysInMonth(int month, int year) { return -1; }
int Date::getDayOfWeek() const { return -1; }
bool Date::operator<(const Date& rhs) const { return false; }
bool Date::operator==(const Date& rhs) const { return false; }
bool Date::operator>(const Date& rhs) const { return false; }
ostream& operator<<(ostream& out, const Date& date) { return out; }
Date.h: #ifndef DATE_H #define DATE_H
#include
#pragma warning( disable : 4290 )
using namespace std;
class Date { public: Date(); Date(int day, int month, int year) throw (logic_error);
int getDay() const; int getMonth() const; int getYear() const;
void showStructure() const;
static bool isLeapYear(int year); static int daysInMonth(int month, int year);
// Programming Exercise 2 int getDayOfWeek() const;
// Programming Exercise 3 bool operator<(const Date& rhs) const; bool operator==(const Date& rhs) const; bool operator>(const Date& rhs) const;
friend ostream& operator<<(ostream& out, const Date& date);
private: int day; int month; int year;
};
#endif
BlogEntry.h: #include
using namespace std;
#include "Text.h" #include "Date.h"
class BlogEntry { public: BlogEntry(); BlogEntry(const Text& initAuthor, const Text& initContents);
Text getAuthor() const; Text getContents() const; Date getCreateDate() const; Date getModifyDate() const;
void setAuthor(const Text& newAuthor); void setContents(const Text& newContents);
void showStructure() const;
// Programming Exercise 1 void printHTML( ostream& out ) const;
private: Text author; Date created; Date modified; Text contents; };
BlogEntry.cpp: #include "BlogEntry.h"
BlogEntry::BlogEntry() { }
BlogEntry::BlogEntry(const Text& initAuthor, const Text& initContents) { }
Text BlogEntry::getAuthor() const { Text temp; return temp; }
Text BlogEntry::getContents() const { Text temp; return temp; }
Date BlogEntry::getCreateDate() const { Date date; return date; }
Date BlogEntry::getModifyDate() const { Date date; return date; }
void BlogEntry::setAuthor(const Text& newAuthor) { }
void BlogEntry::setContents(const Text& newContents) { }
void BlogEntry::printHTML( ostream& out ) const { }
Text.h:
#ifndef TEXT_H #define TEXT_H
#include
using namespace std;
class Text { public:
// Constructors and operator= Text ( const char *charSeq = "" ); // Initialize using char* Text ( const Text &other ); // Copy constructor void operator = ( const Text &other ); // Assignment
// Destructor ~Text ();
// Text operations int getLength () const; // # characters char operator [] ( int n ) const; // Subscript void clear (); // Clear string
// Output the string structure -- used in testing/debugging void showStructure () const;
//-------------------------------------------------------------------- // In-lab operations // toUpper/toLower operations (Programming Exercise 2) Text toUpper( ) const; // Create upper-case copy Text toLower( ) const; // Create lower-case copy
// Relational operations (Programming Exercise 3) bool operator == ( const Text& other ) const; bool operator < ( const Text& other ) const; bool operator > ( const Text& other ) const;
private:
// Data members int bufferSize; // Size of the string buffer char *buffer; // Text buffer containing a null-terminated sequence of characters
// Friends
// Text input/output operations (In-lab Exercise 1) friend istream & operator >> ( istream& input, Text& inputText ); friend ostream & operator << ( ostream& output, const Text& outputText );
};
#endif
Text.cpp: #include "Text.h"
Text::Text ( const char *charSeq ) { }
Text::Text ( const Text &other ) { }
void Text::operator = ( const Text &other ) { }
Text::~Text () { }
int Text::getLength () const { return -1; }
char Text::operator [] ( int n ) const { return 0; }
void Text::clear () { }
void Text::showStructure () const { }
Text Text::toUpper( ) const { Text temp; return temp; }
Text Text::toLower( ) const { Text temp; return temp; }
bool Text::operator == ( const Text& other ) const { return false; }
bool Text::operator < ( const Text& other ) const { return false; }
bool Text::operator > ( const Text& other ) const { return false; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started