Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a constructor to MustComplete_task that takes a string as input. The string is structured precisely the same as the output of MustComplete_task::to_str. For instance,

Create a constructor to MustComplete_task that takes a string as input. The string is structured precisely the same as the output of MustComplete_task::to_str.

For instance, MustComplete_task("15/04/1931! Do laundry") creates a MustComplete_task with the to-do-by date 15/04/1931, the phrase "Do laundry", and a completion status of not complete.

This constructor is in the public portion of a class called MustComplete_task. There are variables in the private portion, including an object that is taken from another class called "Date".

- string phrase;

- Date do_by_date;

- bool complete;

The following methods are in public:

Getters:

- string get_phrase() const returns "phrase" variable

- Date get_do_by_date() const returns "do_by_date" variable

- bool is_complete() const returns "complete" variable

Setters:

- void set_phrase(const string& new_phrase)

- void set_complete() complete = true

- void set_not_complete() complete = false

- void set_do_by_date(const Date& new_do_by_date)

Other methods:

- MustComplete_task(const string& d, Date do_by) initializes private members and set bool complete = false;

- string to_str() const returns a string representation of the item in the format: "dd/mm/yyyy? description". The ? is either the character % (meaning the item is complete), or the character ! (meaning the item is not complete). Then there is one space, followed by a description that continues to the end of the line.

- MustComplete_task(string input) this is the method that needs to be implemented!

Testing:

Todo_item a("15/04/1931% Do laundry"); a.get_phrase()  "Do laundry" a.get_do_by_date().get_day()  15 a.get_do_by_date().get_month()  4 a.get_do_by_date().get_year()  1931 a.is_complete()  (*since the symbol is % meaning complete. If it was "!" then its not complete)

*get_day(), get_month(), get_year() are getters in the Date class.

Please only use and . No other #includes.

If more clarification is needed, please ask.

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

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions