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
}
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
ELEN 1301 Programming Assignment #5. Purpose of the program : Calculating class grade percentage. Section 1...
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 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++) I need to alter the code below to fit the given requirements. You will need to move the calculations to a function. A second function to return the Letter Grade. You will need to define a namespace to contain the CONST. Also, need to define an enum for letter grades: A, B, C, D, and F. Console Student Grade Calculation Form First Name: Larry Last Name: Hobbs Homework Average: 65 Midterm Grade: 90 Final Exam Grade: 75 Student: Larry...
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 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 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:-...
Write a grading program in Java for a class with the following grading policies: There are three quizzes, each graded on the basis of 10 points. There is one midterm exam, graded on the basis of 100 points. There is one final exam, graded on the basis of 100 points. The final exam counts for 40% of the grade. The midterm counts for 35% of the grade. The three quizzes together count for a total of 25% of the grade....
/* C++ program that prompts the user to enter the name of the student, enter the five scores values. Then calculate the total scores of the student. Then finally calculate the average score of the total score value. Then, print the name, total score , average scrore value on console output. */ //main.cpp //include header files #include<iostream> #include<string> #include<iomanip> using namespace std; //start of main function int main() { //declare variable to read string value string studentName; ...
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...
I've built a C++ program that calculates the user's class average based on three test. Can somebody show me how to get the program to look for invalid input? #include <iostream> #include <string> #include <iomanip> using namespace std; int main() { //variables int score_1; //test 1 input from user int score_2; //test 2 input from user int score_3; //test 3 input from user int highest; // the higher score of test 1 & 2 int course_average; //average for class //Introduce...