Question

ELEN 1301 Programming Assignment #5. Purpose of the program : Calculating class grade percentage. Section 1...

ELEN 1301 Programming Assignment #5.

Purpose of the program : Calculating class grade percentage.

Section 1 : Enter the number of classes you attended (0 ~ 12) 5%.

Section 2 : Enter the discussion board score you earned (0 ~ 120) 5%.

Section 3 : Enter the quiz score you earned (0 ~ 240) 10%.

Section 4 : Enter the programming assignment score you earned (0 ~ 120) 20%.

Section 5 : Enter the midterm exam score you earned (0 ~ 100) 20%.

Section 6 : Enter the final exam score you earned (0 ~ 200) 40%.

Section 7 : Calculate final class grade in percent. You must show the results with four digits below the decimal point.

*/

#include<iostream>

#include<iomanip>

using namespace std;

int main()

{

// Write your code here.

return 0;

//main

}

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

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks

#include <iostream>

#include <iomanip>

using namespace std;

//helper method defined to prompt the user for an integer between min and max, return it if it is valid,

//otherwise, loops until a valid input is given

int getInput(string prompt, int min, int max){

                //setting score below min

                int score=min-1;

                //looping as long as score is invalid

                while(score<min || score>max){

                                //displaying prompt, reading score

                                cout<<prompt;

                                cin>>score;

                                //printing error if score is invalid

                                if(score<min || score>max){

                                               cout<<"The value must be between "<<min<<" and "<<max<<endl;

                                }

                }

                return score; //valid

}

int main(){

                //displaying description

                cout<<"Class grade percentage Calculator."<<endl;

                cout<<"Please input all scores as integers"<<endl;

                //reading all inputs using getInput method

                int classes=getInput("Enter the number of classes you attended (0-12): ", 0, 12);

                int disc_board_score=getInput("Enter the discussion board score you earned (0-120): ", 0, 120);

                int quizzes=getInput("Enter the quiz score you earned (0-240): ", 0, 240);

                int programming=getInput("Enter the programming assignment score you earned (0-120): ", 0, 120);

                int mid_term=getInput("Enter the midterm exam score you earned (0-100): ",0,100);

                int final_exam=getInput("Enter the final exam score you earned (0-200): ",0,200);

               

                //dividing each score by the maximum value for each score and multiply with the

                //percentage to get the resultant score for that part.

                double cls=(double)(classes*5.0)/12.0; //5% of classes

                double disc=(double)(disc_board_score*5.0)/120.0; //5% of discussion board score

                double quiz=(double)(quizzes*10.0)/240.0; //10% of quizzes score

                double prog=(double)(programming*20.0)/120.0;

                double mid=(double)(mid_term*20.0)/100.0;

                double final=(double)(final_exam*40.0)/200.0;

                //summing up all these values to get final percentage

                double percentage=cls+disc+quiz+prog+mid+final;

               

                //using a fixed precision of 4 digits after decimal point

                cout<<setprecision(4)<<fixed;

                //displaying percentage

                cout<<endl<<"Percentage is "<<percentage<<endl;

                return 0;

}

/*OUTPUT*/

Class grade percentage Calculator.

Please input all scores as integers

Enter the number of classes you attended (0-12): 15

The value must be between 0 and 12

Enter the number of classes you attended (0-12): 10

Enter the discussion board score you earned (0-120): 100

Enter the quiz score you earned (0-240): -2

The value must be between 0 and 240

Enter the quiz score you earned (0-240): 137

Enter the programming assignment score you earned (0-120): 119

Enter the midterm exam score you earned (0-100): 50

Enter the final exam score you earned (0-200): 197

Percentage is 83.2750

Add a comment
Know the answer?
Add Answer to:
ELEN 1301 Programming Assignment #5. Purpose of the program : Calculating class grade percentage. Section 1...
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
  • ELEN 1301-01 Programming Assignment #11 Due date: November 11, 2015. Wednesday (At the beginning of class.)...

    ELEN 1301-01 Programming Assignment #11 Due date: November 11, 2015. Wednesday (At the beginning of class.) Please submit: 1. Flowchart of your program. (4 points) 2. Printout of your C++ program with a heading comment (Do not forget to add comments within your program). (4 points) 3. Copy of a screenshot after your program is executed. (2 points) 4. You must use a two dimensional array in order to receive any credit. /*    ELEN 1301-01          Programming Assignment #11.   ...

  • Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment...

    Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...

  • C++ Write a program to calculate final grade in this class, for the scores given below...

    C++ Write a program to calculate final grade in this class, for the scores given below . Remember to exclude one lowest quiz score out of the 4 while initializing the array. Display final numeric score and letter grade. Use standard include <iostream> Implementation: Use arrays for quizzes, labs, projects and exams. Follow Sample Output for formatting. May use initialization lists for arrays. Weight distribution is as follows: Labs: 15% Projects: 20% Quizzes: 20% Exams: 25% Final Project: 20% Display...

  • Many classes calculate a final grade by using a weighted scoring system. For example, “Assignments” might...

    Many classes calculate a final grade by using a weighted scoring system. For example, “Assignments” might be worth 40% of your final grade. To calculate the grade for the Assignments category, the teacher takes the percentage earned on the assignments and multiplies it by the weight. So if the student earned a 90% total on the Assignments, the teacher would take 90% x 40, which means the student earned a 36 percent on the Assignments section. The teacher then calculates...

  • In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each gr...

    In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:-...

  • C++ Assignment on Search and Sort for Chapter 8 Problem: Modify the student grade problem to...

    C++ Assignment on Search and Sort for Chapter 8 Problem: Modify the student grade problem to include the following: •   Write a Search function to search by student score •   Write a Search function to search by student last name •   Write a Sort function to sort the list by student score •   Write a Sort function to sort the list by student last name •   Write a menu function that lets user to choose any action he/she want to...

  • Grading Policy In addition to three in-class tests and a final exam, the final grade will...

    Grading Policy In addition to three in-class tests and a final exam, the final grade will include assessment of homework, quiz projects/classroom activities, and classroom participation, according to the following weights 1. Homework and Worksheets 2. Three Tests 3. Final Exam 4. Quizzes and Class Participation/Classroom Citizenshi 1 5% 40% 25% 20% Total 100% Grad Ran 92 100 90-91 88-89 82-87 80-81 an 78 -79 70-77 68 -69 66 67 60- 65 Assignment Grading: Each written assignment, except the Final...

  • Find the errors in following program. //This program uses a switch statement to assign a //...

    Find the errors in following program. //This program uses a switch statement to assign a // letter grade (A, B, C, D, or F) to numeric test score. #include <iostream> uisng namespace std; int main() { int testScore; cout<<"Enter your test score and I will tell you\n"; cout<<"the letter grade you earned: "; cin>>testScore; switch (testScore) { case (testScore < 60) cout<<"Your grade is F.\n"; break; case (testScore <70) cout<<"Your grade is D.\n" break; case (testScore <80) cout<<"Your grade is...

  • Greetings, everybody I already started working in this program. I just need someone to help me...

    Greetings, everybody I already started working in this program. I just need someone to help me complete this part of the assignment (my program has 4 parts of code: main.cpp; Student.cpp; Student.h; StudentGrades.cpp; StudentGrades.h) Just Modify only the StudentGrades.h and StudentGrades.cpp files to correct all defect you will need to provide implementation for the copy constructor, assignment operator, and destructor for the StudentGrades class. Here are my files: (1) Main.cpp #include <iostream> #include <string> #include "StudentGrades.h" using namespace std; int...

  • Today assignment , find the errors in this code and fixed them. Please I need help...

    Today assignment , find the errors in this code and fixed them. Please I need help with find the errors and how ro fixed them. #include <iostream> #include <cstring> #include <iomanip> using namespace std; const int MAX_CHAR = 100; const int MIN_A = 90; const int MIN_B = 80; const int MIN_C = 70; double getAvg(); char determineGrade(double); void printMsg(char grade); int main() { double score; char grade; char msg[MAX_CHAR]; strcpy(msg, "Excellent!"); strcpy(msg, "Good job!"); strcpy(msg, "You've passed!"); strcpy(msg, "Need...

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
ADVERTISEMENT