final_project/Interface.cpp
// calculate scores needed to reach each letter grade
// Note: we are assuming, for example, that a D is always 59.5.
// This is not always the case.

calculate scores needed to reach each letter grade
Note: we are assuming, for example, that a D is always 59.5.
This is not always the case.
calculate scores needed to reach each letter grade Note : we are assuming for example that a D is always 59 . 5 . This is not always the case .
void calculate_earned_course_score(const std::vector<Grade>& grades, const double max_course_score){
        const std::map<char,double> course_scores = {
            {'A', max_course_score*0.895},
            {'B', max_course_score*0.795},
            {'C', max_course_score*0.695},
            {'D', max_course_score*0.595}
        };
        double earned_course_score = accumulate_score(grades);
        std::cout << "Max possible score: " << max_course_score << '\n'
            << "Score earned: " << earned_course_score << '\n';
        std::cout << "Score needed to earn a perfect score: "
            << subtract_scores(max_course_score, earned_course_score) << '\n';
        for(auto iter = course_scores.begin(); iter != course_scores.end(); ++iter){
            std::string article = "a"; 
            if (iter->first == 'A'){ article = "an"; }
            std::cout << "Score needed to earn " << article << ' ' << iter->first << ' '
                << subtract_scores(iter->second, earned_course_score) << '\n';
        }
    }
void calculate_earned_course_score ( const std :: vector < Grade > & grades , const double max_course_score ) { const std :: map < char , double > course_scores = { { ' ' , max_course_score * 0.895 } , { ' ' , max_course_score * 0.795 } , { ' ' , max_course_score * 0.695 } , { ' ' , max_course_score * 0.595 } } ; double earned_course_score = accumulate_score ( grades ) ; std :: cout << " " << max_course_score << ' \n ' << " " << earned_course_score << ' \n ' ; std :: cout << " " << subtract_scores ( max_course_score , earned_course_score ) << ' \n ' ; for ( auto iter = course_scores . begin ( ) ; iter != course_scores . end ( ) ; ++ iter ) { std :: string article = " " ; if ( iter -> first == ' ' ) { article = " " ; } std :: cout << " " << article << ' ' << iter -> first << ' ' << subtract_scores ( iter -> second , earned_course_score ) << ' \n ' ; } }
calculate scores needed to reach each letter grade
Note: we are assuming, for example, that a D is always 59.5.
calculate scores needed to reach each letter grade Note : we are assuming for example that a D is always 59 . 5 .
// grammar
