Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Download and unzip these files, and load them into your favorite environment: DLLTaskManager.zipDownload DLLTaskManager.zip You are given: MainDLL.cpp: the main function TaskManager.cpp/.hpp: the interface for

Download and unzip these files, and load them into your favorite environment: DLLTaskManager.zipDownload DLLTaskManager.zip You are given: MainDLL.cpp: the main function TaskManager.cpp/.hpp: the interface for the task manager, which uses the doubly linked list Task.cpp/.hpp: the declarations and definitions for the Task class, the data type stored in our Task Manager DNode.hpp: the class declaration for the DNode class DNode.cpp: a shell for the DNode class definitions DLL.hpp: the class declaration for the doubly linked list class DLL.cpp: a shell for the DLL class definitions Additionally, you are given 2 example input files of tasks to test with. You'll want to place these files in the same folder as the rest of the code (but they do not get added to the build target - that's just for compilation). It's a lot easier to read long lists of inputs from a file than having the user type them out every time. The TaskManager class handles the file input for you. Modify MainDLL.cpp to change the file. You will need to write: Constructor definitions for the DNode class: 5pts Method definitions for the DLL class: 2 constructors: 7pts void push(string n, int p, int t, int m): 5pts Task *pop(): 5pts

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
#include "DLL. hpp" #include #include using namespace std; DLL: : DLL() { DLL: : DLL(string t, int p, int h, int m) { DLL: : ~DLL( ) { void DLL: : push (string n, int p, int h, int m) { Task *DLL: : pop( ) { int DLL: : remove (int tn) { void DLL: : addTime (int h, int m) { void DLL: : removeTime(int h, int m) { void DLL: : moveUp (int t) { void DLL: : moveDown (int tn) { void DLL: : changePriority(int tn, int newp) { void DLL: : listDuration (int *th, int *tmint tp) { void DLL: : printList( ) { void DLL: : printList (int p) {| #ifndef DLL_HPP_ #define DLL_HPP_ #include ' Node-mm" using namespace std; class DLL { DNodg *first: int humTasks; int toinrs; int toimin: DLL(): // constructor initializes an empty list DLL(string t, int p, int m, int 5): // constructor, initializes a list with one new node with data x ~DLL(): // destructor void push(string t, int p, int h, int m): // does what you'd think, with a caveat that if the //priority isn't 3, it will move the task up to the end of the set of tasks with that priority. //In other words, if the priority is 1, it will traverse the list in reverse order until it finds a //task with a priority of 1, and insert the new task between the last task with a priority of //1 and the first task with a priority of 2 //it also updates the total time of the list Task *pop(); //does what you'd think make sure to update the total time of the list int remove(int tn):// removes a task (based on its number) and updates the total time of the list. // Returns the task number if it was found, or 1 otherwise. void moveUp(int tn); // moves task with number tn up one in the list. //If it is at the beginning of the list, //it will be moved to the end of the list. // NOTE: if this moves a task up before a task with a higher priority (1 is // higher priority than 2 I know the wording is a bit weird), then this // changes the priority of the task being moved to that higher priority moveDown(int tn); //moves task with task number to down one in the list. //If it is at the end of the list, it will move to //beginning of the list. //NOTE: if this moves a task after a task with a lower priority (again, 3 is //a lower priority than 2) then this changes the priority of the task being //moved. changePriority(int tn, int new : //changes the priority of the task tn listDuration(int *th, int *tm nt p); // gets the total list duration in hours and minutes (passed //in as pointers) of a particular priority (so the total time /eeded to complete all tasks with priority of p) void printList(): // prints the entire task list void printList(int p); //print out all tasks with a priority of p; void addTime(int h, int m): // Helper function to add time to total time of list void removeTime(int h, int m): // helper function to remove time from the total time of the list #endif /* DLL_HPP_ */ Meditate, 3, 0:20 Yoga, 2, 1:10 Play games, 1, 4:30 Eat Chocolate, 2, 0:30 Play soccer, 1, 3:20 Nap, 1, 0:45 Clean my room, 3, 0:15 Watch Videos, 2, 3:30 Couch Surf, 2, 3:10 Pet my Dog, 1, 0:45 Code, 3, 6:45 Pet my cat, 2, 0:5 Text friends, 3, 2:30TaskManager : : TaskManager ( ) { list = new DLL( ) ; readList("ListofTasks . txt") ; list->printList() ; cout printList( ) ; cout > choice; if (choice = =1) { addTask ( ) ; else if (choice == 2) { removeTask( ) ; else if ( choice == 3) { moveUp ( ) ; else if (choice == 4) { moveDown ( ) ; else if (choice ==5) { changePriorityofTask( ) ; list->printList( ) ; else if (choice ==6){ getPriorityTasks ( ) ; else if ( choice = = 7) { List->printList( ) ; else if (choice == 8) { ByeNow ( ) ; }void TaskManager: : changePriorityofTask( ) { cout> tnum; cout > pnum; if (tnum >0 && pnum > 0) { List->changePriority(tnum, pnum) ; list->printList( ) ; void TaskManager: : getPriorityTasks( ) { int mintot = 0; int hrtot = 0; cout > prio; list->listDuration(&hrtot, &mintot, prig); cout printList(prio) ; return; void TaskManager: : moveUp( ) { cout> tnum; if (tnum >0) { list->moveUp (tnum) ; list->printList( ) ; string TaskManager: : getTitle( ) { string str = un; while (str == "") { getline (cin, str); string title; title = strip(str); return title;void TaskManager: : moveDown ( ) { cout> tnum; if ( tnum >0) { List->moveDown ( tnum) ; list->printList( ) ; } void TaskManager: : removeTask( ) { cout> tnum; if ( tnum >0) { tnum = list->remove (tnum) ; if ( tnum > 0) { cout > s; if (s == "yes" ) { cout printList ( ) ;void TaskManager: : addTask( ) { cout>prio; hrs = strip(taskstr) ; int hr = 0; stringstream tmp2 (hrs) ; tmp2>>hr; mins = taskstr; stringstream tmp3 (mins) ; int min = 0; tmp3>>min; cout 0) { list->push (task, prio. hr..min) ; list->printList ( ) ; void TaskManager: : ByeNow( ) { cout using namespace std; class TaskManager { DLL *list; // the doubly linked list of playsongs int lenmin; int lensec; public: TaskManager () ;//constructor that reads tasks from ListofTasks, txt TaskManager (string fname); // constructor that lets you enter your own text file. void interface(); //the ridiculously simple Task Manager interface void addTask(); //the method for adding a Task to the list (this calls the DLL push method) void removeTask( ); //the method called for removing a song (this calls the DLL Remove (int tasknum) method) void ByeNow( ); //quick goodbye message letting you know the program has ended void moveUp ( ); //moves a song up one in the task list (so the task above it moves down one)- //calls the DLL's moveUp (int tasknum) method void moveDown ( ) ; //Does the opposite of moveUP. Calls the DLL's moveDown ( int tasknum) method void changePriorityofTask() ; // Changes the priority of a particular task void readList (string name); //Reads in a list of tasks from a text file. name holds the name of the text file void printList( ); //prints out your task list (calls the DLL's printList( ) method string strip(string &s); //I used this to strip special characters and tokenize my string. string getTitle(); //I used to read in a new task list title void getDuration( ); // used to find out and print out the playlist's total duration void getPriorityTasks (); //This prints out all tasks with those #endif /* PLAYLIST_HPP_ */

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_2

Step: 3

blur-text-image_3

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions