Question: Answer the following question by using the code given at the end. Question 1: The following code snippet is present in main(): Catalog poli(Polytechnic University
Answer the following question by using the code given at the end.
Question 1: The following code snippet is present in main():
Catalog poli("Polytechnic University of Puerto Rico"); Write the instruction that would add the course CECS 2223, Computer Programming II Laboratory, 0 credits into the catalog.
Question 2: Paste the code developed to define the void Catalog::addCourse(string,string,int) method.
Question 3: Paste the code developed to define the void Course::setCredits(int) method.
Question 4: Paste the code developed to define the void Catalog::findCourse(string) method.
Question 5: Paste the code developed to define the void Catalog::dropCourse(string) method.
The provided code, this the only that was given code wise. probably needs to be fixed.
Catalog.h
/* CECS 2223, Computer Programming II Lab Winter 2021, Sec. 05 Date: January 12, 2022 Topic: Lab 6 - Composition File name: Catalog.h Name: [YOUR NAME HERE], ID#[YOUR ID NUMBER HERE] Complete the C++ code as required */ class Catalog{ private: string universityName; int count; Course** courses; public: Catalog(); Catalog(string); ~Catalog(); void setName(string); int getCount() const; string getName() const; bool findCourse(string) const; void addCourse(string,string,int); void dropCourse(string); void orderCatalog(); void printCatalog() const; }; Catalog.cpp
/* CECS 2223, Computer Programming II Lab Winter 2021, Sec. 05 Date: January 13, 2021 Topic: Lab 6 - Composition File name: Catalog.cpp Name: [YOUR NAME HERE], ID#[YOUR ID NUMBER HERE] Complete the C++ code as required */ // the default constructor assigns the empty string, "", to strings and -1 to count // the Course pointer is initialized to nullptr Catalog::Catalog() { } Catalog::Catalog(string){ } // the destructor prints the phrase // "Catalog for [name] has been destroyed" Catalog::~Catalog(){ } void Catalog::setName(string) { } int Catalog::getCount() const { } string Catalog::getName() const { } // adds a course to the catalog // creates the Course object void Catalog::addCourse(string,string,int) { } // drops a course from the catalog // invokes the Course object's destructor void Catalog::dropCourse(string); // orders courses alphabetically by code void Catalog::orderCatalog(); // prints the list of all courses in the catalog // starts with the phrase // "[name] has [count] courses in the catalog, they are:" void Catalog::printCatalog() const; Course.h
/* CECS 2223, Computer Programming II Lab Winter 2021, Sec. 05 Date: January 12, 2022 Topic: Lab 6 - Composition File name: Course.h Name: [YOUR NAME HERE], ID#[YOUR ID NUMBER HERE] Complete the C++ code as required */ #include using namespace std; class Course{ private: string name; string code; int credits; public: Course(); Course(string,string,int); ~Course(); // required because we use dynamic memory void setName(string); void setCode(string); void setCredits(int); string getName() const; string getCode() const; int getCredits() const; void printCourse() const; }; Course.cpp
/* CECS 2223, Computer Programming II Lab Winter 2021, Sec. 05 Date: January 12, 2022 Topic: Lab 6 - Composition File name: Course.cpp Name: [YOUR NAME HERE], ID#[YOUR ID NUMBER HERE] Complete the C++ code as required */ // the default constructor assigns the empty string, "", to strings and -1 to credits Course::Course(){ } // the parameterized constructor Course::Course(string,string,int) { } // the destructor prints the phrase // "Course [code] has been destroyed" Course::~Course() { } // sets the course name void Course::setName(string) { } // sets the course code void Course::setCode(string){ } // sets the credits for the course // value MUST be > -1 void Course::setCredits(int){ } string Course::getName() const { } string Course::getCode() const { } int Course::getCredits() const { } // prints the course info in the format // courseCode - courseName, x credits void Course::printCourse() const { } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
