/**
 * CS-11 Asn 7
 * gradebook.cpp
 * Purpose: caclulates overall grade for the semester.
 *
 * @author Ed Parrish
 * @version 1.3 10/14/05
 */
#include <fstream>
#include <iostream>
using namespace std;

// Avoid magic numbers.
// Change the following constants however you like.
const double WEIGHT_ASN = .30;
const double WEIGHT_EXER = .15;
const double WEIGHT_MID = .20;
const double WEIGHT_FINAL = .35;

const double MIN_A = .90;
const double MIN_B = .80;
const double MIN_C = .70;
const double MIN_D = .60;

const int NUM_DECIMAL_PLACES = 2;
const double PERCENT_MULTIPLIER = 100;

/**
 * Load the scores from the fileName into data[].
 *
 * @param fileName The name of the file.
 * @param total The nominal total value of all scores.
 * @param actual The actual value of all scores.
 */
void loadScores(string fileName, int& total, int& actual);

/**
 * Calculates the weighted percentage of the score.
 * Also makes sure that the score does not exceed 100%.
 *
 * @param total The nominal total value of all scores.
 * @param actual The actual value of all scores.
 * @param weight The weight to apply to the calculated score.
 * @return The weighted percentage.
 */
double calcWeightedPct(int total, int actual, double weight);

/**
 * Outputs the grade calculations to the stream in the specified format.
 *
 * @param out The output stream for writing the report.
 * @param wpAsn The weighted percentages of assignments.
 * @param wpExer The weighted percentages of exercises.
 * @param wpMid The weighted percentages of midterms.
 * @param wpFinal The weighted percentages of finals.
 */
void report(ostream& out, double wpAsn, double wpExer, double wpMid,
    double wpFinal);

/**
 * Converts the percentage to a letter grade.
 *
 * @param percentage The percentage to convert.
 * @return The letter grade.
 */
char toLetterGrade(double percentage);

/**
 * Extra credit calculation to show the percentage needed on the final exam
 * for the scoreWanted.
 *
 * @param wanted The percentage wanted for the final grade.
 * @param earned The percentage earned to date.
 * @return The percentage needed on the final exam.
 */
double calcScoreNeeded(double wanted, double earned);

// Application driver
int main() {

    return 0;
}

// Load the total and actual scores from the fileName
void loadScores(string fileName, int& total, int& actual) {

}

// Calculates the weighted percental of a score.
// Also makes sure that the score does not exceed the weight.
double calcWeightedPct(int total, int actual, double weight) {
    double result = 0;

    // DANGER: watch out for division by zero!!!!

    // Prevent assignment result > weight

    return result;
}

// Outputs the grade calculations in the specified format.
void report(ostream& out, double wpAsn, double wpExer, double wpMid,
        double wpFinal) {

}

// Converts the percentage to a letter grade.
char toLetterGrade(double percentage) {
    char letterGrade = 'z';
    // Use if-else statements to return a letter grade

    return letterGrade;
}

