In C++ please answer ALL parts of this programming question. Thank you in advance. 10.13 LAB: Course information (derive

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

In C++ please answer ALL parts of this programming question. Thank you in advance. 10.13 LAB: Course information (derive

Post by answerhappygod »

In C++ please answer ALL parts of this programming question.Thank you in advance.
10.13 LAB: Course information (derived classes)
Given main(), define a Course base class withfunctions to set and get the courseNumber and courseTitle. Alsodefine a derived class OfferedCourse with functions toset and get instructorName, term, and classTime.
Ex. If the input is:
the output is:
Main.ccp
#include "OfferedCourse.h"
int main() { Course myCourse; OfferedCoursemyOfferedCourse;
string courseNumber,courseTitle; string oCourseNumber,oCourseTitle, instructorName, term, classTime;
getline(cin,courseNumber); getline(cin,courseTitle);
getline(cin,oCourseNumber); getline(cin,oCourseTitle); getline(cin,instructorName); getline(cin, term); getline(cin, classTime);
myCourse.SetCourseNumber(courseNumber); myCourse.SetCourseTitle(courseTitle); myCourse.PrintInfo();
myOfferedCourse.SetCourseNumber(oCourseNumber); myOfferedCourse.SetCourseTitle(oCourseTitle); myOfferedCourse.SetInstructorName(instructorName); myOfferedCourse.SetTerm(term); myOfferedCourse.SetClassTime(classTime); myOfferedCourse.PrintInfo();
cout << " Instructor Name: " << myOfferedCourse.GetInstructorName()<< endl; cout << " Term:" << myOfferedCourse.GetTerm() << endl; cout << " ClassTime: " << myOfferedCourse.GetClassTime() <<endl;}
Course.h
#ifndef COURSEH#define COURSEH
#include <iostream#include <string>
using namespace std;
class Course { // TODO: Declare private data members -courseNumber, courseTitle
// TODO: Declare mutator functions - // SetCourseNumber(),SetCourseTitle()
// TODO: Declare accessor functions- // GetCourseNumber(),GetCourseTitle()
// TODO: Declare PrintInfo()
};
#endif
OfferedCourse.h
#ifndef OFFERED_COURSEH#define OFFERED_COURSEH
#include "Course.h"
class OfferedCourse : public Course // TODO: Declare private data members -instructorName, term, classTime
// TODO: Declare mutator functions - // SetInstructorName(),SetTerm(), SetClassTime()
// TODO: Declare accessor functions - // GetInstructorName(),GetTerm(), GetClassTime()
};
#endif
Course.ccp
#include "Course.h"
// TODO: Define mutator functions- // SetCourseNumber(),SetCourseTitle()
// TODO: Define accessor functions - // GetCourseNumber(),GetCourseTitle()
// TODO: Define PrintInfo()
OfferedCourse.ccp
#include "OfferedCourse.h"
// TODO: Define mutator functions -// SetInstructorName(), SetTerm(),SetClassTime()
// TODO: Define accessor functions // GetInstructorName(), GetTerm(),GetClassTime()
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply