Homework Help Question & Answers
// (a) print the name and courseCode of the dynamically created course above to screen //…
// (a) print the name and courseCode of the dynamically created course above to screen // …
// (b) change the value of courseCode of the dynamically created course above to “BIO 101” // …
// (c) print the name and code of the dynamically created course above again on the screen // … //
#include #include using namespace std; class courseType { private: string name; string courseCode; public: courseType(string theName = “Default name”, string theCode= “Default code”) { name = theName; courseCode = theCode; } string getName() const { return name; } string getCode() const { return courseCode; } void setName(string newName) {name = newName; } void setCode(string newCode) {courseCode = newCode; } }; int main() { // creating one course dynamically courseType *coursePtr = new courseType(“Biology I”);
// (a) print the name and courseCode of the dynamically created course above to screen // …
// (b) change the value of courseCode of the dynamically created course above to “BIO 101” // …
// (c) print the name and code of the dynamically created course above again on the screen // … // de-allocating memory delete coursePtr; system(“pause”); return 0; }