// Ashton Dreiling
//Essay exercise program
#include <iostream>
#include "Essay class.h"
#include <string>
#include <stdlib.h>
#include <iostream>
constint NUM_FOR_CAL1=0;
usingnamespace std;
void userInput(double &grammar, double &spelling, double &CL, double &content);
int main ()
{
// Some variables
double grmmr;
double splling;
double correctlength;
double con;
string grde;
userInput(grmmr, splling, correctlength, con);
Essay essayObject(grmmr, splling, correctlength, con);
// Displaying the scores that were inputed
cout << "The recorded scores are:" << endl;
cout << "+ Grammar : " << essayObject.getGrammar() << endl;
cout << "+ Spelling : " << splling << endl;
cout << "+ Correct Length : " << correctlength << endl;
cout << "+ Content : " << con << endl;
cout << "+ Total : " << grmmr + splling + correctlength + con << endl; // (***) "correctlength + 2" should be "correctlength"
essayObject.addScore();
essayObject.findGrade();
cout << endl;
cout << "The grade for this essay is : " << essayObject.getGrade() << endl;
system("Pause");
return 0;
}//end main
void userInput(double &grmmr, double &splling, double &correctlenght, double &con)
{
//input from user to enter points
cout << "Enter the points for an essay." << endl;
cout << "Grammar (must be 30 or less points) : ";
cin >> grmmr;
while (grmmr>30 || grmmr<NUM_FOR_CAL1)
{
cout << "Grammar must be 30 or less points. Enter again : ";
cin >>grmmr;
}//end while loop
cout << "Spelling (must be 20 or less points) : ";
cin >> splling;
while(splling>20 || splling<NUM_FOR_CAL1)
{
cout << "Spelling must be 20 or less points. Enter again : ";
cin>>splling;
}//end while loop
cout << "Correct length (must be 20 or less points) : ";
cin>>correctlenght;
while(correctlenght>20 || correctlenght<NUM_FOR_CAL1)
{
cout << "Correct length must be 20 or less points. Enter again : ";
cin >> correctlenght;
}//end while loop
cout << "Content (must be 30 or less points). : ";
cin>>con;
while(con>30 || con<NUM_FOR_CAL1)
{
cout << "Content must be 30 or less points. Enter again : ";
cin >> con;
}//end while loop
cout << endl;
}// end user input
What is this? class GradedActivity : public Essay { /* ... */ };
Every graded activity is an essay of some kind?
Shouldn't it be (as specified in the UML diagram):
there are different kinds of graded activities; one of them is an essay? class Essay : public GradedActivity { /* ... */ };
// Ashton Dreiling
//Essay exercise program
#include <iostream>
#include "Essay class.h"
#include <string>
#include <stdlib.h>
#include <iostream>
constint NUM_FOR_CAL1=0;
usingnamespace std;
void userInput(double &grammar, double &spelling, double &CL, double &content);
int main ()
{
// Some variables
double grmmr;
double splling;
double correctlength;
double con;
string grde;
userInput(grmmr, splling, correctlength, con);
Essay essayObject(grmmr, splling, correctlength, con);
// Displaying the scores that were inputed
cout << "The recorded scores are:" << endl;
cout << "+ Grammar : " << essayObject.getGrammar() << endl;
cout << "+ Spelling : " << splling << endl;
cout << "+ Correct Length : " << correctlength << endl;
cout << "+ Content : " << con << endl;
cout << "+ Total : " << grmmr + splling + correctlength + con << endl;
essayObject.addScore();
GradedActivity thisStudent(essayObject); // (***) How GradedActivity is declared
thisStudent.findGrade();
cout << endl;
cout << "The grade for this essay is : " << thisStudent.getGrade() << endl;
system("Pause");
return 0;
}//end main
void userInput(double &grmmr, double &splling, double &correctlenght, double &con)
{
//input from user to enter points
cout << "Enter the points for an essay." << endl;
cout << "Grammar (must be 30 or less points) : ";
cin >> grmmr;
while (grmmr>30 || grmmr<NUM_FOR_CAL1)
{
cout << "Grammar must be 30 or less points. Enter again : ";
cin >>grmmr;
}//end while loop
cout << "Spelling (must be 20 or less points) : ";
cin >> splling;
while(splling>20 || splling<NUM_FOR_CAL1)
{
cout << "Spelling must be 20 or less points. Enter again : ";
cin>>splling;
}//end while loop
cout << "Correct length (must be 20 or less points) : ";
cin>>correctlenght;
while(correctlenght>20 || correctlenght<NUM_FOR_CAL1)
{
cout << "Correct length must be 20 or less points. Enter again : ";
cin >> correctlenght;
}//end while loop
cout << "Content (must be 30 or less points). : ";
cin>>con;
while(con>30 || con<NUM_FOR_CAL1)
{
cout << "Content must be 30 or less points. Enter again : ";
cin >> con;
}//end while loop
cout << endl;
}// end user input