Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

1. Add a new method, displayNote(), to the Note class. It should display a formatted version of the note, something like this: From: Barrett Body: Meeting tomorrow at 11 Next, change the method...

1 answer below »
1. Add a new method, displayNote(), to the Note class. It should display a formatted version of the note,
something like this:
From: Ba
ett
Body:
Meeting tomo
ow at 11
Next, change the method display( ) in NoteKeeper to call displayNote() for each Note object in its list of Notes
(instead of just doing print(object), which uses str () to do the printing). Then run testNoteKeeper to see it
work.
2. Create a class called TimedNote that inherits from Note (this is why the data members of Note should be
protected, not private — they'll be reused in TimedNote). It should have the protected fields below with getters
and setters, a default constructor, and a__ str () method that uses the parent's str ( ) for the inherited
data. The new data members are:
sendTo — string, who the note is intended fo
dateTime — string, time of creation (you may use the Python datetime li
ary instead)
It should also have a displayNote ( ) method — this should first display the sendTo and dateTime fields,
then call the parent's displayNote () to display the rest, so that it looks like this (for the data in #3):
Date: 2/27/20 1:00 pm
To: Ba
ett
From: The Boss
Body:
You are fired

3. Write a main program called testTimedNote.py that creates two timedNote objects. The first one's data
should be "You are fired’, "The Boss', ‘Ba
ett’, 2/27/20 1:00 pm"; the second's data should be 'You can"t fire me,
I quit’, Ba
ett! 'The Boss', 2/28/20 8:30am’. Then call displayNote ( ) to print both notes.
4. Write a main program called testNoteKeeper2.py by copying testNoteKeeper.py and changing the second
object to a TimedNote object (leave the first one a regular Note object), set its sendTo and dateTime fields,
and add both objects to the NoteKeeper object, then display the list.
5. Add a private static variable, count, to Note, initialized to zero. In Note’s constructor, increment it. Add a
static method, getCount( ), to Note that returns count. Then add a print statement to testNoteKeeper2.main to
display the count with the label “Note count =
Answered Same Day Dec 07, 2022

Solution

Anubhav answered on Dec 08 2022
39 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here