Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

sorry if it looks weird i dont know why its in boxes like that. A question i can

ID: 3756577 • Letter: S

Question

sorry if it looks weird i dont know why its in boxes like that. A question i cant wrap my head around. Some assistance would be nice pleas, i just wat to understand the algorithm cuz theres soo much to do. thanks in advance

Using C++ , design an Abstract Data Type class named MyGrades. The class

must have the following private members :

• Vectors to hold grades for Programming Assignments and Midterm Exams .

• Programming Assignments will count as 20 % , Exam 1 will count as 20

% , and Exam 2 will count as 25%..

Class should have the following seven member functions

• Set Programming Assignment Grade

• Set test grades

• Show all programming assignment grades and calculating the average.

• Show all test grades

• Show overall grades

• Delete A Programmng Assignment Grade

• Delete A Test Grade

Programming assignments and test grades are to be defined as doubles

Characters and other form must be rejected.

Selection must be 1 – 7 or 9 . Otherwise it is rejected.

Program must continue until the user enters 9 to exit the program.

Output values must include 2 numeric values after the decimal point.

• Only integers are allowed as input values.

• Programming assignment grades are between 0 and 10.

• Only 2 Test grades are allowed to be recorded.

• Test grades are between 0 - 20 for test-1 and 0 – 25 for test-2

***SAMPLE OUTPUT****

1. Set A Programming Assignment Grade

2. Set A Test Grade

3. Show All Programming Assignment Grades

4. Show All Test Grades

5. Show Overall Grades

6. Delete A Programming Assignment Grades

7. Delete A Test Grade

9. Exit The Program

Enter your choice --->

1

Enter A Programming Assignment grade: 10

1. Set A Programming Assignment Grade

2. Set A Test Grade

3. Show All Programming Assignment Grades

4. Show All Test Grades

5. Show Overall Grades

6. Delete A Programming Assignment Grades

7. Delete A Test Grade

9. Exit The Program

Enter your choice --->

1

Enter A Programming Assignment grade: 7

1. Set A Programming Assignment Grade

2. Set A Test Grade

3. Show All Programming Assignment Grades

4. Show All Test Grades

5. Show Overall Grades

6. Delete A Programming Assignment Grades

7. Delete A Test Grade

9. Exit The Program

Enter your choice --->

5

My Overall Grades so far are as follows :

Show Overall All Grades.

Programming Assignment Grades are As Follows

10.00 7.00

Average Programming Assignments Grades is

17.00 Out of 20

No Test Grades are recorded

Overall Total -- > 17.00 out of 20

1. Set A Programming Assignment Grade

2. Set A Test Grade

3. Show All Programming Assignment Grades

4. Show All Test Grades

5. Show Overall Grades

6. Delete A Programming Assignment Grades

7. Delete A Test Grade

9. Exit The Program

Enter your choice --->9

End of program

Using C++ , design an Abstract Data Type class named MyGrades. The class

must have the following private members :

Explanation / Answer

Here is the code as requested:

Incase of any query kindly add a comment below.

***************************************Start***********************************

// Example program
#include <iostream>
#include <vector>
#include <type_traits>

using namespace std;

class MyGrades{

//Data Members are being defined here
private:
  
//Vectors to hold grades for Programming Assignments and Midterm Exams .
vector<double> myProgrammingAssignments;
vector<double> myMidTermExams;
  
double myProgrammingAssignmentsAvg;
  
//Member functions
public:
  
//This method will set the value of programming assignments
void setProgrammingAssignment(){
double assignmentValue=0;
cout<<"Enter A Programming Assignment grade: ";
cin>>assignmentValue;
cout<<endl;
if(cin)
{
if((assignmentValue>=0)||(assignmentValue<=10))
{
myProgrammingAssignments.push_back(assignmentValue);   
}else
{
cout<<"Programming Grade Value must be within 0 to 10"<<endl;
}   
}else
{
cout<<"Invalid input type: Only accepts double type"<<endl;
}   
  
}
  
//This method will set the value of test grades
void setTestGrades(){
double gradeValue=0;   
cout<<"Enter A Test grade: ";
cin>>gradeValue;
cout<<endl;
  
if(cin)
{
if(myMidTermExams.size()<2)
{
if(myMidTermExams.size()==0)
{
//Condition checking test1 value 0-20
if((gradeValue>=0)&&(gradeValue<=20))
{
myMidTermExams.push_back(gradeValue);
}else
{
cout<<"Test Grade 1 Value must be within 0 to 20"<<endl;
}
}else
{
//Condition checking test2 value 0-25
if((gradeValue>=0)&&(gradeValue<=25))
{
myMidTermExams.push_back(gradeValue);
}else
{
cout<<"Test Grade 2 Value must be within 0 to 25"<<endl;
}
}
}else
{
cout<<"Only two test grades are allowed"<<endl;   
}
}else
{
cout<<"Invalid input type: Only accepts double type"<<endl;   
}
  
}
  
//This method will display the prgramming assignment grades and will
//also calculate the average
void showProgrammingAssignmentsAndAverage(){
if(!myProgrammingAssignments.empty()){
double myAverageCalculator=0;
cout.precision(2);

cout<<"Programming Assignment Grades are As Follows"<<endl;
vector<double>::iterator it;
for(it=myProgrammingAssignments.begin();it!=myProgrammingAssignments.end(); it++){
myAverageCalculator+=*it;
cout<<*it<<" ";
}   
cout<<endl;
int numberOfAssignments=myProgrammingAssignments.size();
myProgrammingAssignmentsAvg=myAverageCalculator;
cout<<"Average Programming Assignments Grades is"<<endl;
cout<<myProgrammingAssignmentsAvg<<" out of "<<numberOfAssignments*10<<endl;
}else{
cout<<"No Programming Assignment Grades are recorded"<<endl;
}
}
  
//This method will show all test grades
void showTestGrades(){
cout.precision(2);
if(!myMidTermExams.empty()){
cout<<" Test Grades are as Follows"<<endl;
vector<double>::iterator it;
for(it=myMidTermExams.begin();it!=myMidTermExams.end(); it++){
cout<<*it<<" ";
}
}else
{
cout<<"No Test Grades are recorded";
}
  
cout<<endl;
}

//This method will show Overall Grades{
void showOverallGrades(){
cout.precision(2);
cout<<"Show Overall All Grades"<<endl;
showProgrammingAssignmentsAndAverage();
showTestGrades();
double sumOfMidTermExams=0;
//More code can be added here depending upon the condition to calculate overall grade
  
cout<<"Overall Total --> ";   
int numberOfAssignments=myProgrammingAssignments.size();
if(myMidTermExams.empty()){
cout<<myProgrammingAssignmentsAvg<<" out of "<<numberOfAssignments*10<<endl;
} else if(myProgrammingAssignments.empty()){
sumOfMidTermExams=myMidTermExams[0]+myMidTermExams[1];
cout<<sumOfMidTermExams<<endl;
} else {
cout<< (myProgrammingAssignmentsAvg)+(sumOfMidTermExams)<<endl;  
}
}
  
//This method will delete a prgramming grade
void deleteProgrammingGrade(){
cout<<"Deleting Programming Grade "<<endl;
myProgrammingAssignments.pop_back();
}
  
  
//This method will delete a test grade
void deleteTestGrade(){
cout<<"Deleting Test Grade "<<endl;
myMidTermExams.pop_back();
}

};

int main(){
MyGrades objMyGrades; // Declaring an object of MyGrades class
  
int inputValue=0;
while(inputValue!=9){
cout<<"1. Set A Programming Assignment Grade"<<endl;
cout<<"2. Set A Test Grade"<<endl;
cout<<"3. Show All Programming Assignment Grades"<<endl;
cout<<"4. Show All Test Grades"<<endl;
cout<<"5. Show Overall Grades"<<endl;
cout<<"6. Delete A Programming Assignment Grades"<<endl;
cout<<"7. Delete A Test Grade"<<endl;
cout<<"9. Exit The Program"<<endl;
cout<<"Enter your choice --->"<<endl;
cin>>inputValue;


switch(inputValue){
case 1:
objMyGrades.setProgrammingAssignment();
break;
case 2:
objMyGrades.setTestGrades();
break;
case 3:
objMyGrades.showProgrammingAssignmentsAndAverage();
break;
case 4:
objMyGrades.showTestGrades();
break;
case 5:
objMyGrades.showOverallGrades();
break;
case 6:
objMyGrades.deleteProgrammingGrade();
break;
case 7:
objMyGrades.deleteTestGrade();
break;
case 9:
cout<<"Thank you"<<endl;
break;
default:
cout<<"Invalid Choice please try again"<<endl;
break;
}
  
}

}


*******************************End******************************************