Question: Need Help with the To Do Section. ( Data Structures ) 1 . / / Specification file for the GeneralStudent class / / See below

Need Help with the To Do Section. (Data Structures)
1.// Specification file for the GeneralStudent class
// See below the section you need to complete.
#ifndef GENERAL_STUDENT_H
#define GENERAL_STUDENT_H
#include
using namespace std;
class GeneralStudent
{
protected:
string name; // Student name
string idNumber; // Student ID
int yearAdmitted; // Year student was admitted
public:
// Default or no-argument constructor initializes data member variables.
GeneralStudent()
{
name ="";
idNumber ="";
yearAdmitted =0;
}
// Constructor with argument sets the data member variables values.
GeneralStudent(string n, string id, int year){ set(n, id, year); }
// The set function sets the attribute data or data member variables.
void set(string n, string id, int year)
{
name = n; // Assign the name
idNumber = id; // Assign the ID number
//**TO DO: Complete this section
// Validate the year below such that the yearAdmitted is
// set to years between 2000 and 2024, else set it to 1999**.
}
// Accessor functions used to access, get, or retrieve data member
// variable values.
const string getName() const { return name; }
const string getIdNum() const { return idNumber; }
int getYearAdmitted() const { return yearAdmitted; }
// Pure virtual function. This function MUST be implemented in the
// ComputerScienceStudent derived class.
virtual int getRemainingHours() const =0;
};
#endif
2.// Specification file for the ComputerScienceStudent class
// See below the sections you need to complete.
#ifndef COMPUTER_SCIENCE_STUDENT_H
#define COMPUTER_SCIENCE_STUDENT_H
#include "GeneralStudent.h"
// Constants for required hours
const int MATH_HOURS =20; // Math hours
const int CS_HOURS =40; // Computer science hours
const int GEN_ED_HOURS =60; // General Ed hours
class ComputerScienceStudent : public GeneralStudent
{
private:
int mathHours; // Hours of math taken
int csHours; // Hours of Computer Science taken
int genEdHours; // Hours of general education taken
public:
// Default Constructor
ComputerScienceStudent() : GeneralStudent()
{
mathHours =0;
csHours =0;
genEdHours =0;
}
// Constructor
ComputerScienceStudent(string n, string id, int year) :
GeneralStudent(n, id, year)
{
mathHours =0;
csHours =0;
genEdHours =0;
}
//**TO DO: Mutator functions declarations. You need to implement each of
// of these functions in the ComputerScienceStudent.cpp file following
// the example I have provided for the setMathours function.
void setMathHours(int mh);
void setCsHours(int csh);
void setGenEdHours(int geh);
//**TO DO: Complete this section
// Add below the definition or implementation of the accessor
// functions as inline functions for the private members of this class
// or for each of the above mutator functions. Ensure that these
// functions do not change the data member values ***.
// Overridden getRemainingHours function, defined in
// ComputerScienceStudent.cpp file.
virtual int getRemainingHours() const;
//**TO DO: Implement the following functions in the
//ComputerScienceStudent.cpp file.
void getData(); // Get the values for all the data member variables.
void displayData(); // Display the values for all the data member
// variables and the remaining hours to graduate.
};
#endif

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!