Example of the program:
Codeboard · the IDE for the classroom[
^]
The application receives assessment info and calculates the points needed to earn letter grades in this course. Assessments include all grade items from this course, (quizzes, labs, exams and final project.) The user should be able to input assessment info for all completed grade items in the course. After all of the info has been input, the program provides calculated output for how many points are needed to earn various letter grades, (A, B, C, D).
The practical application of this tool is for the student to see how many points are needed on the final exam for a specific grade in the course.
Use object-oriented programming to build this application.
At a minimum, the class structure should include the following:
private data members: title and score.
public functions to interface with the private members
each assessment should be an object of the class
To properly implement the class and collect input:
a container to store the input data as objects of the class
What I have tried:
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
int points = 0;
string assignment;
double score;
double total;
char choice = 'y';
cout << "GRADE CALCULATOR\n"
<< "**************************\n"
<< "Please provide course grading and assignment details.\n"
<< "This program will caclulate total points earned and\n"
<< "display how many points are needed to earn different\n"
<< "letter grades for the course.\n"
<< "**************************\n";
cout << "How many points possible for the course?: ";
cin >> points;
while (tolower(choice == 'y'))
{
cout << endl;
cout << "ASSIGNMENT TITLE (ie week 1 lab, etc): ";
cin >> assignment;
getline (cin, assignment);
cout << "score: ";
cin >> score;
cout << endl;
cout << "Add another? (y/n): ";
cin >> choice;
total += score;
}
cout << endl;
cout <<"**************************\n";
cout <<"ASSIGNMENT\t\t\tSCORE";
for (int i = 0; i < 10; i++) {
cout << "For Counter Value: " << i << endl;
}
cout << " " << assignment << endl;
cout << endl;
cout << "**************************\n";
cout << " TOTAL POINTS POSSIBLE: " << points << endl;
cout << " TOTAL POINTS EARNED: " << total << endl;
cout << " POINTS NEEDED FOR A: " << endl;
cout << " POINTS NEEDED FOR B: " << endl;
cout << " POINTS NEEDED FOR C: " << endl;
cout << " POINTS NEEDED FOR D: " << endl;
cout << "**************************";
return 0;
}
//
#include "Grade.h"
const double score = 0.0;{
set_score(score);
}
double Grade::get_score() const {
return score;
}
void Grade::set_score(const double score){
score = score;
}
std::string Grade::get_title()const{
return title;
}
void Grade::set_title(const std::string& title){
title = title;
}
std::ostream& operator<<(std::ostream& os, Grade& grade){
os << "\nAssignment: " << grade.get_title()
<< "\nScore: " << grade.get_score()
<< "\nComments: ";
std::vector<std::string>& comments = grade.get_comments();
if (comments.empty()){
os << "none\n";
}
for (unsigned i = 0; i < comments.size(); ++i){
os << i+1 << ". " << comments[i] << '\n';
}
return os;
}
//
#ifndef Grade_Calculator_H
#define Grade_Calculator_H
#include <string>
#include <vector>
class Grade
{
private:
double score;
std::string title;
public:
Grade(double score_param = 0.0)
{
score = score_param;
}
double get_score() const
{
return score;
}
void set_score(double score_param)
{
score = score_param;
}
std::string get_title() const;
void set_title(const std::string&);
};
#endif
//
#ifndef Grade_Calculator_H
#define Grade_Calculator_H
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <map>
#include <limits>
#include "Grade.H"