Question

You will create a Grade Program that will calculate students’ weighted averages. You are going to...

You will create a Grade Program that will calculate students’ weighted averages. You are going to have the user enter lab grades, test grades, and project grades. You will then display a grade report of each individual average along with their overall average and letter grade.

  1. Ask the user to enter their lab grades. Call the averageGrade function that will allow the user to enter their grades and calculate their average.
  1. averageGrade Function: This will pass the average back to the main function. You should NOT send any parameters to this function. You will be using a while loop, with a priming read and a sentinel value to end the loop. This means the user should be able to enter any number of grades that they want and exit the loop when they are done entering grades. When they exit the loop, compute the average (Make sure to desk check the average). Then you will return the average back.

     

  1. Ask the user to enter their test grades. Again, call the averageGrade function that you created to average any number of grades.

  1. Ask the user to enter their project grades. Again, call the averageGrade function.
  1. Now you will calculate the students overall average in the class. Create a classAverage function to compute the average for the class from the 3 averages above. Use the following percentages as the weights for each of the grades (Lab – 50%, Tests – 40%, and Project – 10%). You will pass the function the 3 averages and return the final average.
  1. Determine Letter Grade: Create a getLetterGrade function to determine the final letter grade based on their number average calculated in step 5. Make this a void function that is sent two parameters, the number grade by value and the letter grade by reference.

     

  1. Display the Midterm Grade Report: Create a displayGradeReport function to output all of your results. This includes the lab average, test average, project average, class average, and class letter grade. This will also be a void function. Use setprecision() and setw() to make your output look nice.

  1. Do While Loop: Ask user if they want to enter data for a new student. If yes, then clear the screen and loop back, if not then display some type of message to end the program.

When completed with the program there should be 4 functions in addition to the MAIN function.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
#include <iomanip>
using namespace std;
float averageGrade()
{
   float temp;
   int count = 0;
   float sum = 0;
   float avg;
   cout<<"enter grade or -1 to quit:\t";
   cin>>temp;
   count++;
   sum += temp;
   while(temp != -1)
   {
       cout<<"enter grade or -1 to quit:\t";
       cin>>temp;
       count++;
       sum += temp;
   }
   avg = sum/count;
   return avg;
}
float classAverage(float avg_lab_grade, float avg_test_grade, float avg_project_grade)
{
   float avg;
   float temp_lab = (avg_lab_grade * 50)/100;
   float temp_test = (avg_test_grade * 40)/100;
   float temp_project = (avg_project_grade * 10)/100;
   avg = temp_lab + temp_test + temp_test;
   return avg;
}
void getLetterGrade(float marks, char* letter)
{
   if(marks >= 90)
   {
       *letter = 'A';
   }
   else if(marks >= 80 && marks < 90)
   {
       *letter = 'B';
   }
   else if(marks >= 70 && marks < 80)
   {
       *letter = 'C';
   }
   else if(marks >= 60 && marks < 70)
   {
       *letter = 'D';
   }
   else
   {
       *letter = 'F';
   }
}
void displayReports(float avg_lab_grade, float avg_test_grade, float avg_project_grade, float final_grade, char letter)
{
   cout<<"*****************REPORTS******************"<<endl;
   cout<<"Average Lab Grade:\t"<<setprecision(3)<<avg_lab_grade<<endl;
   cout<<"Average Test Grade:\t"<<setprecision(3)<<avg_test_grade<<endl;
   cout<<"Average Project Grade:\t"<<setprecision(3)<<avg_project_grade<<endl;
   cout<<"Average Final Grade:\t"<<setprecision(3)<<final_grade<<endl;
   cout<<"Average Letter Grade:\t"<<letter<<endl;
   cout<<"*******************************************"<<endl;
}
int main()
{
   char ch;
   do
   {
       cout << "\033[2J\033[1;1H";
       cout<<"enter lab grades:\t"<<endl;
       float avg_lab_grade;
       avg_lab_grade = averageGrade();
       cout<<"enter test grades:\t"<<endl;
       float avg_test_grade;
       avg_test_grade = averageGrade();
       cout<<"enter project grades:\t"<<endl;
       float avg_project_grade;
       avg_project_grade = averageGrade();
       float final_avg = classAverage(avg_lab_grade, avg_test_grade, avg_project_grade);
       char letter;
       getLetterGrade(final_avg, &letter);
       displayReports(avg_lab_grade, avg_test_grade, avg_project_grade, final_avg, letter);
       cout<<"want to enter reports of another student (y/n):\t";
       cin>>ch;
   }while(ch != 'n');
   cout<<"Thank You"<<endl;

  
}

If you have any doubts please comment and please don't dislike.

Add a comment
Know the answer?
Add Answer to:
You will create a Grade Program that will calculate students’ weighted averages. You are going to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MATLAN Quiz 2 Create a MATLAB function that calculates the average of values in a vector that als...

    MATLAN Quiz 2 Create a MATLAB function that calculates the average of values in a vector that also drops the slowest values. Call this function average_drop(). The function must have a single input (the vector) and a single output (the average without the lowest score). 1. 2. Create a MATLAB program that asks the user to input grades for a student and calculates the final grade and letter grade. The user must enter 5 quiz grades (worth 50% of the...

  • DO NOT USE ARRAYS IF YOU KNOW ABOUT ARRAYS, I WANT YOU TO USE 3 VARIABLES,...

    DO NOT USE ARRAYS IF YOU KNOW ABOUT ARRAYS, I WANT YOU TO USE 3 VARIABLES, IT WILL FORCE YOU TO USE COMPOUND LOGICAL STATEMENTS FOR THE IF STATEMENTS. Create a program that will display a menu to the user. The choices should be as follows: Enter 3 grades Show average (with the 3 grades) and letter grade Show highest grade Show lowest grade Exit If you want to put the menu into a function you may. The program should...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • You are to write a program which will ask the user for number of students (dynamic...

    You are to write a program which will ask the user for number of students (dynamic array of class Student). For each student, you will ask for first name and number of grades (dynamic array of grades as a variable in Student). **The program should give the student random grades from 0-100** Find the averages of each student and display the information. **Display name, grades, and average neatly in a function in the Student class called Display()** Sort the students...

  • You are to write a program which will ask the user for number of students (dynamic...

    You are to write a program which will ask the user for number of students (dynamic array of class Student). For each student, you will ask for first name and number of grades (dynamic array of grades as a variable in Student). **The program should give the student random grades from 0-100** Find the averages of each student and display the information. **Display name, grades, and average neatly in a function in the Student class called Display()** Sort the students...

  • using java Program: Please read the complete prompt before going into coding. Write a program that...

    using java Program: Please read the complete prompt before going into coding. Write a program that handles the gradebook for the instructor. You must use a 2D array when storing the gradebook. The student ID as well as all grades should be of type int. To make the test process easy, generate the grade with random numbers. For this purpose, create a method that asks the user to enter how many students there are in the classroom. Then, in each...

  • Create a class called Student. This class will hold the first name, last name, and test...

    Create a class called Student. This class will hold the first name, last name, and test grades for a student. Use separate files to create the class (.h and .cpp) Private Variables Two strings for the first and last name A float pointer to hold the starting address for an array of grades An integer for the number of grades Constructor This is to be a default constructor It takes as input the first and last name, and the number...

  • Create a C++ program to calculate grades as well as descriptive statistics for a set of...

    Create a C++ program to calculate grades as well as descriptive statistics for a set of test scores. The test scores can be entered via a user prompt or through an external file. For each student, you need to provide a student name (string) and a test score (float). The program will do the followings: Assign a grade (A, B, C, D, or F) based on a student’s test score. Display the grade roster as shown below: Name      Test Score    ...

  • Write a program that will calculate your letter grade at the end of the semester for...

    Write a program that will calculate your letter grade at the end of the semester for CSIS130. Your program will read an input file that shall contain all the tests scores and lab scores for the semester, and the input file data should be in the following format: full name of student Test1 Score (0…100), Test2 Score (0..100) , Final Exam Score (0..100), Total Number of Labs: N NLab Scores (0=Fail, 1=Pass) [You will have N lab scores each separated...

  • Java program Program: Grade Stats In this program you will create a utility to calculate and...

    Java program Program: Grade Stats In this program you will create a utility to calculate and display various statistics about the grades of a class. In particular, you will read a CSV file (comma separated value) that stores the grades for a class, and then print out various statistics, either for the whole class, individual assignments, or individual students Things you will learn Robustly parsing simple text files Defining your own objects and using them in a program Handling multiple...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT