C++ Create a program that asks for the separate grading points and then gives a
ID: 3913307 • Letter: C
Question
C++
Create a program that asks for the separate grading points and then gives a total and a letter grade. This program should loop around until I say that I am done. For example: (program display is bold, user input is underlined).Your Assignment class should define these point categories as member variables. It must contain proper constructors and methods to hold the data and to add up the total. It will use then use setScore and getLetterGrade from the GradedActivity class to display the results. Make sure that your member data is protected (with validation that creates an Exit_Failure when necessary).
Make your input and output professional. Break your code down into functions as necessary.
Please enter data for the next student:
Code choice/execution: (total points possible = 50): 40
Modular code: (total points possible = 20): 20
Comments and Formatting (total points possible = 10): 10
Input/Output Professionalism (total points possible = 10): 6
Jing: (total points possible = 10): 10
Calculated Total: 86
Grade: B
Do you wish to enter another assignment? (Y/N) Y
Please enter data for the next student:
Code choice/execution: (total points possible = 50): 50
Modular code: (total points possible = 20): 20
Comments and Formatting (total points possible = 10): 10
Input/Output Professionalism (total points possible = 10): 10
Jing: (total points possible = 10): 10
Calculated Total: 100
Grade: A
Do you wish to enter another assignment? (Y/N) N
Okay, bye!
Programming Requirements:
Design an Assignment class that is derived from the GradedActivity class presented in your book. The Assignment class should determine the grade a student receives on a programming project. The student's total scores can be up to 100
The Assignment class is based on (inherits from) the GradedActivity. The Assignment class will contain members for the scores and the associated mutator/accessor functions, BUT it will call the setScore function and the getLetterGrade function from GradedActivity
Explanation / Answer
#include <iostream>
using namespace std;
class GradedActivity {
private:
int totalScore;
public:
GradeActivity() {
this->totalScore = 0;
}
GradeActivity(int totalScore) {
this->totalScore = totalScore;
}
void setScore(int score) {
this->totalScore = score;
}
char getLetterGrade() {
if(this->totalScore >= 90) {
return 'A';
} else if(this->totalScore < 90 && this->totalScore >= 80) {
return 'B'';
} else if(this->totalScore < 80 && this->totalScore >= 70) {
return 'C';
} else if(this->totalScore < 70 && this->totalScore >= 60) {
return 'D';
} else if(this->totalScore < 60 && this->totalScore >= 50) {
return 'E';
} else {
return 'F';
}
}
};
class Assignment : public GradeActivity{
private:
const int CODECHOICE = 50;
const int MODULARCODE = 20;
const int FORMATTING = 10;
const int IOPROFESSIONALISM = 10;
const int JING = 10;
int codeChoiceMarks;
int modularityMarks;
int formattingMarks;
int ioproffmarks;
int jing;
public:
Assignment(){
codeChoiceMarks = 0;
modularityMarks = 0;
formattingMarks = 0;
ioproffmarks = 0;
jing = 0;
}
void readCodeChoiceMarks() {
cout<<"Code choice/execution: (total points possible = 50):"<<endl;
cin >> codeChoiceMarks;
}
void readModularityMarks() {
cout<<"Modular code: (total points possible = 20):"<<endl;
cin >> modularityMarks;
}
void readFormattingMarks() {
cout<<"Comments and Formatting (total points possible = 10):"<<endl;
cin>>formattingMarks;
}
void readIOProfessionalismMarks() {
cout<<"Input/Output Professionalism (total points possible = 10): "<<endl;
cin>>formattingMarks;
}
};
int main() {
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.