Question #297404

Develop a C++ program to design a College Course class includes fields representing department, course number, credit hours, and tuition. Its child, Lab course, includes one more field that holds a lab fee charged in addition to the tuition. Create appropriate functions for these classes, and write a main () function that instantiates and uses object of each class.

Expert's answer

#include <iostream>
using namespace std;

class CollegeCourse {
public:
  string department;
  int course_number;
  int credit_hours;
  string tuition;
}

class LabCourse: public CollegeCourse {
public:
  double lab_fee;
}

int main() {

  CollegeCourse ccourse;
  ccourse.department = "Something;";

  cout << ccourse.department << "\n";

  LabCourse lcourse;
  lcourse.lab_fee = 34.0d;

  cout << lcourse.lab_fee <<"\n";

  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS