Contents

Overview

Your job in this assignment is to create the fifth iteration of the Notes program. You are going to update your program so that it uses a class instead of a struct for the Notes object (it should contain a method for printing a note) and everytime a note is modified, the entire array of notes should be resorted so that notes with a lower priority level are at the beginning of the list (lower number = higher importance).

Step 1: the Note class

To make this happen, you should add you will need to get rid of the Note struct above main and create two new files—Note.h and Note.cpp. These will hold the Note class interface and implementation, respectively. Remember, the class should provide a method to print a Note instance, as well as two constructors. The first constructor should be a default constructor, so has no parameters. The other should have on parameter per data member. Don't forget: because you have multiple .cpp files, you'll have to compile on the command line, not in Sublime. Your compile line should look like this:

g++ pa5.cpp Note.cpp -o pa5

Step 2: a sort function

In order to ensure that the array of notes has the lowest priority level notes at the beginning, you should make a function that will sort the array by a note's priority level. This will look very similar to what we did in Lab 12. Keep in mind, your function should work with any size array, not just an array with two notes in it.

Here's an example of what the program should look like when run:

$ ./pa5

Current notes:
Note 1: 
Note 2: 

Would you like to [d]elete|[m]odify a note or [q]uit? m
Which note would you like to modify? 1
Please enter the new note: Pick up bread
Please enter the new note's priority level: 3

Current notes:
Note 1: 
Note 2: Pick up bread (Priority 3)

Would you like to [d]elete|[m]odify a note or [q]uit? m
Which note would you like to modify? 1
Please enter the new note: Study for exam
Please enter the new note's priority level: 1

Current notes:
Note 1: Study for exam (Priority 1)
Note 2: Pick up bread (Priority 3)

Would you like to [d]elete|[m]odify a note or [q]uit? q
Okay, goodbye!

Notice that Note 1 and 2 switched places when I set Note 2's priority level to be lower.

(Back to top)

Requirements

Start by copying your (or my) PA4 and work from there.

(Back to top)

Extra credit

Extra credit up to 5 points. Make sure you indicate in your program header (in the description) whether you've attempted the extra credit, otherwise I won't count it!!!

EC-1 (2 points)

Submit your assignment 24 hours early—by Sunday night at 11:59.

EC-2 (2 points)

Implement one of the sorts we did not implement in lab.

EC-3 (5 points)

Allow users to add new notes, or completely remove old ones. This is challenging because you will have to grow and shrink your array (which means copying data from an old array to a new one that is larger or smaller).

(Back to top)

Submissions

Everything should be uploaded to Canvas by the deadline posted.

(Back to top)