Question
studentRoll.h #ifndef STUDENTROLL_H #define STUDENTROLL_H #include #include student.h class StudentRoll { public: StudentRoll(); void insertAtTail(const Student &s); std::string toString() const; StudentRoll(const StudentRoll &orig); ~StudentRoll(); StudentRoll
studentRoll.h
#ifndef STUDENTROLL_H
#define STUDENTROLL_H
#include
#include "student.h"
class StudentRoll {
public:
StudentRoll();
void insertAtTail(const Student &s);
std::string toString() const;
StudentRoll(const StudentRoll &orig);
~StudentRoll();
StudentRoll & operator=(const StudentRoll &right);
private:
struct Node {
Student *s;
Node *next;
};
Node *head;
Node *tail;
};
#endif
studentRoll.cpp
#include
#include "studentRoll.h"
StudentRoll::StudentRoll() {
head = tail = NULL;
}
void StudentRoll::insertAtTail(const Student &s) {
}
std::string StudentRoll::toString() const {
}
StudentRoll::StudentRoll(const StudentRoll &orig) {
head = tail = NULL;
}
StudentRoll::~StudentRoll() {
}
StudentRoll & StudentRoll::operator =(const StudentRoll &right ) {
// The next two lines are standard, and you should keep them.
// They avoid problems with self-assignment where you might free up
// memory before you copy from it. (e.g. x = x)
if (&right == this)
return (*this);
// TODO... Here is where there is code missing that you need to
// fill in...
// KEEP THE CODE BELOW THIS LINE
// Overloaded = should end with this line, despite what the textbook says.
return (*this);
}
use the header file to implement the functions in the cpp file in order to pass the 3 tests provided! Use basic c++ and you can only include whatever is given in the files! thank you!
test studentRoll01.cpp #include student .hu #include "studentRoll hit #include kios tream #include "tddFuncs.h" using name space std; int main cout Running tests from FILE endl Student s Phill Conrad 1234567) ASSERT EQUALS Phill Conrad rs getName()); ASSERT EQUALS (1234567, s.get rm Student Roll sri ASSERT EQUALS sr. to String sr. insert AtTail (s) ASSERT EQUALs [[Phill Conrad, 12345671) sr.tostring setName "Chris Gaucho"); s set Perm (2222222) s .getName()) ASSERT EQUALS Chris Gaucho sr. insert AtTail(s): ASSERT EQUALs [Phill Conrad, 1234567], Chris Gauch 222222211", sr. t return 0 test studentRoll01.cpp #include student .hu #include "studentRoll hit #include kios tream #include "tddFuncs.h" using name space std; int main cout Running tests from FILE endl Student s Phill Conrad 1234567) ASSERT EQUALS Phill Conrad rs getName()); ASSERT EQUALS (1234567, s.get rm Student Roll sri ASSERT EQUALS sr. to String sr. insert AtTail (s) ASSERT EQUALs [[Phill Conrad, 12345671) sr.tostring setName "Chris Gaucho"); s set Perm (2222222) s .getName()) ASSERT EQUALS Chris Gaucho sr. insert AtTail(s): ASSERT EQUALs [Phill Conrad, 1234567], Chris Gauch 222222211", sr. t return 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started