Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // IDScore.cpp
- // Sander Malmquist
- // COSC 1030 Spring 2016
- // Program 13
- // April 29, 2016
- #include "IDScore.h"
- IDScore::IDScore(const char *in_name, int in_score, int ID) :
- studentName(in_name), studentScore(0), stuID(0)
- {
- if (in_score > 0) {
- studentScore = in_score;
- }
- else {
- throw TestError("Negative grade");
- }
- if (ID > 0)
- {
- stuID = ID;
- }
- else
- {
- throw ScoreError("Student ID less than one");
- }
- }
- IDScore::IDScore(string in_name, int in_score, int ID) :
- studentName(in_name), studentScore(0), stuID(0)
- {
- if (in_score > 0) {
- studentScore = in_score;
- }
- else {
- throw TestError("Negative grade");
- }
- if (ID > 0)
- {
- stuID = ID;
- }
- else
- {
- throw ScoreError("Student ID less than one");
- }
- }
- int IDScore::getID(void)
- {
- return stuID;
- }
- // IDScore.h
- // Sander Malmquist
- // COSC 1030 Spring 2016
- // Program 13
- // April 29, 2016
- #ifndef IDSCORE_H
- #define IDSCORE_H
- #include"TestScore.h"
- class ScoreError : public runtime_error
- {
- public:
- ScoreError(const string& msg) :runtime_error(msg) {}
- };
- class IDScore : public TestScore
- {
- public:
- IDScore(const char *in_name, int in_score, int ID);
- IDScore(string in_name, int in_score, int ID);
- int getID(void);
- private:
- string studentName;
- int studentScore;
- int stuID;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement