Answer to Question #297404 in C++ for Rajen

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.

1
Expert's answer
2022-02-18T01:21:13-0500
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog