/**
 * CS-11 Asn 8
 * gradebook.cpp
 * Purpose: caclulates overall grade for the semester.
 *
 * @author Your Name Here
 * @version 1.0 10/23/04
 */
#include <fstream>
#include <iostream>
using namespace std;

// Avoid magic numbers.
// Change the following constants however you like.
const int NUM_AREAS = 4;

const int MAX_ASN = 11;
const int MAX_EXER = 12;
const int MAX_MID = 2;
const int MAX_FINAL = 2;

const double WEIGHT_ASN = .30;
const double WEIGHT_EXER = .15;
const double WEIGHT_MID = .20;
const double WEIGHT_FINAL = .35;

const double WEIGHTS[] = {WEIGHT_ASN, WEIGHT_EXER, WEIGHT_MID, WEIGHT_FINAL};
const string AREAS[] = {"Assignments", "Exercises", "Midterm", "Final Exam"};
const int INDEX_ASN = 0;
const int INDEX_EXER = 1;
const int INDEX_MID = 2;
const int INDEX_FINAL = 3;

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 data The array in which the data is loaded.
 * @param size The maximum array size.
 * @return The number of elements loaded into the array.
 */
int loadScores(double data[], int size, string fileName);

/**
 * Calculates the weighted percentage of the data where data[0] is
 * the maximum possible for all scores and each subsequent item is
 * an individual score. Also makes sure that the score does not
 * exceed 100%.
 *
 * @param data The array in which the data is loaded.
 * @param size The number of array items used.
 * @param weight The weight to apply to the data percentage.
 * @return The weighted percentage.
 */
double calcScore(double data[], int numItems, double weight);

/**
 * Outputs the grade calculations in the specified format.
 *
 * @param weightedScores The weighted percentages of all areas.
 * @param size The number of array elements.
 * @param out The output stream to write the data to.
 */
void report(double weightedScores[], int size, ostream& out = cout);

/**
 * 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 scores from the fileName into data[].
int loadScores(double data[], int size, string fileName) {
    // Read the number of scores
    // Also load scores into the data[]
    int index = 0;

   return index;
}

// Calculates the weighted percentage of the data where data[0] is the maximum
// possible for all scores and each subsequent item is an individual score.
// Also makes sure that the score does not exceed 100%.
double calcScore(double data[], int numItems, double weight) {
    double result = 0;

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

    return result;
}

// Outputs the grade calculations in the specified format.
void report(double weightedScores[], int size, ostream& out) {

}

// 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;
}

