Question

In: Computer Science

create a C++ program using Visual Studio that could be used by a college to track...

create a C++ program using Visual Studio that could be used by a college to track its courses. In this program, create a CollegeCourse class includes fields representing department, course number, credit hours, and tuition. Create a child (sub class) class named LabCourse, that inherits all fields from the the CollegeCourse class, 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 objects of each class. Save the file as Courses.cpp. Compile this application using Visual Studio and run it to make sure it is error free. Please attach your project folder in a zipfile when submitting. GRADING RUBRIC: - define a class named CollegeCourse - private fields for department, course number, credit hours, and tuition - public function(s) setting the private fields - public function that displays a CollegeCourse's data - define a class named LabCourse - inherit from CollegeCourse - include field that holds a lab fee - public function(s) setting the private field (don't forget the parent) - public function that displays a LabCourse's data (don't forget the parent) - main() function that instantiates a LabCourse, populates all private and inherited fields, calls both private and inherited methods

Solutions

Expert Solution

#include<iostream>
#include<string>

using namespace std;

class CollegeCourse {
private:
int courseNum;
string deptName;
int creditHours;
double tuitionDue;
public:
void setFields (int, string, int, double);
void displayData();
int getNum();
};
void CollegeCourse::setFields (int num, string dept, int credit, double tuition) {
courseNum = num;
deptName = dept;
creditHours = credit;
tuitionDue = tuition;
}
void CollegeCourse::displayData() {
cout << "Course Number: " << courseNum << " Name: " << deptName << endl;
cout << "Credit Hours: " << creditHours << " Tuition Due: $ " << tuitionDue << endl;
}
class LabCourse : public CollegeCourse {
private:
int courseNum;
string deptName;
int creditHours;
double tuitionDue;
double labFee;
public:
void setFields (int num, string dept, int hours, double tuition, double lab);
void displayData();
};
void LabCourse::setFields (int num, string dept, int hours, double tuition, double lab) {
courseNum = num;
deptName = dept;
creditHours = hours;
tuitionDue = tuition;
labFee = lab;
}
void LabCourse::displayData(){
cout << "Course Number: " << courseNum << " Name: " << deptName << endl;
cout << "Credit Hours: " << creditHours << " Tuition Due: $ " << tuitionDue << endl;
cout << "Lab Fee: " << labFee << endl;
}
int main() {
CollegeCourse *obj = new CollegeCourse;
obj->setFields(101,"Physics",4,120.00);
obj->displayData();
delete obj;
cout << endl << endl;
LabCourse *obj2 = new LabCourse;
obj2->setFields(111,"Physics",4,120.00,45.00);
obj2->displayData();
delete obj2;
return 0;
}


Related Solutions

In visual Studio C++ Create a program that uses a for loop to input the high...
In visual Studio C++ Create a program that uses a for loop to input the high temperature, and low temperature for each day of the week. The high and low will be placed into two elements of the array. For each loop the high and low will be placed into the next set of elements of the array. After the temps for all seven days have been entered into the array, a for loop will be used to pull out...
answer the following using C# Design and program a Visual Studio Console project in C# that...
answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...
Using Visual Studio in C#; create a grading application for a class of ten students. The...
Using Visual Studio in C#; create a grading application for a class of ten students. The application should request the names of the students in the class. Students take three exams worth 100 points each in the class. The application should receive the grades for each student and calculate the student’s average exam grade. According to the average, the application should display the student’s name and the letter grade for the class using the grading scheme below. Grading Scheme: •...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store data...
USING VISUAL STUDIO 2017, LANGUAGE VISUAL C# I have struggled on this program for quite some...
USING VISUAL STUDIO 2017, LANGUAGE VISUAL C# I have struggled on this program for quite some time and still can't quite figure it out. I'm creating an app that has 2 textboxes, 1 for inputting customer name, and the second for entering the number of tickets the customer wants to purchase. There are 3 listboxes, the first with the days of the week, the second with 4 different theaters, and the third listbox is to display the customer name, number...
write a c++ program using micro soft visual studio 2010 to write a program and store...
write a c++ program using micro soft visual studio 2010 to write a program and store 36 in variable x and 8 in variable y. add them and store the result in the variable sum. then display the sum on screen with descriptive text. calculate the square root of integer 36 in x. store the result in a variable. calculate the cube root of integer 8 in y. store result in a variable. display the results of square root and...
Create a Visual Studio console project (c++) containing a main() program that declares a const int...
Create a Visual Studio console project (c++) containing a main() program that declares a const int NUM_VALUES denoting the array size. Then declare an int array with NUM_VALUES entries. Using a for loop, prompt for the values that are stored in the array as follows: "Enter NUM_VALUES integers separated by blanks:" , where NUM_VALUES is replaced with the array size. Then use another for loop to print the array entries in reverse order separated by blanks on a single line...
Create an ASP.Net Website using Visual Studio with Visual Basic.Net: Create a simple calculator that has...
Create an ASP.Net Website using Visual Studio with Visual Basic.Net: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store...
C++ PROGRAM Using the attached C++ code (Visual Studio project), 1) implement a CoffeeMakerFactory class that...
C++ PROGRAM Using the attached C++ code (Visual Studio project), 1) implement a CoffeeMakerFactory class that prompts the user to select a type of coffee she likes and 2) returns the object of what she selected to the console. #include "stdafx.h" #include <iostream> using namespace std; // Product from which the concrete products will inherit from class Coffee { protected:    char _type[15]; public:    Coffee()    {    }    char *getType()    {        return _type;   ...
String Manipulator Write a program to manipulate strings. (Visual Studio C++) In this program take a...
String Manipulator Write a program to manipulate strings. (Visual Studio C++) In this program take a whole paragraph with punctuations (up to 500 letters) either input from user, initialize or read from file and provide following functionalities within a class: a)   Declare class Paragraph_Analysis b)   Member Function: SearchWord (to search for a particular word) c)   Member Function: SearchLetter (to search for a particular letter) d)   Member Function: WordCount (to count total words) e)   Member Function: LetterCount (ONLY to count all...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT