Question: the assignment is split into two photos and then there is a. h split into three photos and a main split into two photos. .h







the assignment is split into two photos and then there is a. h split into three photos and a main split into two photos.
.h file########################################################################################
#include
class Task { public: string element; int duration; int completionTime; bool critical; Task() : element(""), duration(0), completionTime(0), critical(0) {}; Task( string theString , int theDuration , int theCompletion, bool isCritical ) : element(theString), duration(theDuration), completionTime(theCompletion), critical(isCritical) {};
}; class TreeNode { Task info; TreeNode * leftChild; TreeNode * rightSibling;
TreeNode() : info(), leftChild(NULL), rightSibling(NULL) {};
TreeNode( Task theTask, TreeNode *lt, TreeNode *rt ) : info( theTask ), leftChild( lt ), rightSibling( rt ) { }
friend class Tree; friend class TreeItr; };
class TreeItr { public: TreeItr( ) : current( NULL ) { } bool isPast( ) const { return current == NULL; } bool hasChild( ) const { return current->leftChild != NULL; }
void advanceSibling( ) { if( !isPast( ) ) current = current->rightSibling; } void advanceChild( ) { if( !isPast( ) ) current = current->leftChild; }
Task getInfo() { if( !isPast( ) ) return current->info; }
void changeInfo( Task x) { current->info = x; }
private: TreeNode *current;
TreeItr( TreeNode *theNode ) : current( theNode ) { }
friend class Tree; };
class Tree { public: explicit Tree( ); bool isEmpty( ) const; TreeItr createChild( TreeItr p ); TreeItr TreeRoot( ) const;
private: TreeNode *root;
};
main##################################################################################
#include
void setupTree(Tree & T) { TreeItr current, i,j,k,s; Task tmp; current = T.TreeRoot(); tmp.element = " install product"; tmp.duration = 4; tmp.critical = 1; current.changeInfo(tmp); tmp.critical = 0; s = T.createChild(current); tmp.element = "test main"; tmp.duration = 4; s.changeInfo(tmp); k = T.createChild(current); tmp.element = "get CEO report"; tmp.duration = 1; k.changeInfo(tmp); // ... and so forth } void preorderPrint(TreeItr p) { cout
int main() { Tree theJobs; TreeItr Top; Top = theJobs.TreeRoot(); setupTree(theJobs); calcCompletion(Top); determineCritical(Top); cout
Background. Once you have graduated you may write code in a team of software developers. Further into your career, you may be put in charge of seeing a project through as the project lead. In this case it important to keep track of deadlines. install platform write main install lih install sort design design vo design design get Dept es 2 engine 4 Figure 1: A typical software project Scenario. In Figure 1 you can see a typical software project. The numbers give the time required for the task in weeks. In this case the dependencies among the tasks are tree like, this is not always the case in practice but for this assignment we will assume that we have such a structure. Some tasks are critical, which means that if those tasks are delayed then the entire project will be delayed. In fact, all tasks on the path "design protocol", "write I/o", test user interface", install product", are critical, whereas task "get CEO input" is not
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
