0% found this document useful (0 votes)
44 views

Extra Credit Project 7: Final Grade 04-26-17

This document describes a C++ program that calculates student final grades. The program takes exam, homework, and final exam grades as input from the user for each student. It calculates a final grade using a weighted formula and assigns a letter grade. It then displays the grades and letter grade for each student and outputs it to a text file. The user can then choose to input another student's grades or quit the program.

Uploaded by

Young Major
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Extra Credit Project 7: Final Grade 04-26-17

This document describes a C++ program that calculates student final grades. The program takes exam, homework, and final exam grades as input from the user for each student. It calculates a final grade using a weighted formula and assigns a letter grade. It then displays the grades and letter grade for each student and outputs it to a text file. The user can then choose to input another student's grades or quit the program.

Uploaded by

Young Major
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Quiana Major

Marc Jeune
Milena Arauz
Extra Credit
Project 7: Final Grade
04-26-17

Project 7: Final
Grade

This project is a C++ program that allows the user to enter the following information
from the keyboard for each student in a class (up to 20 students):Name Exam 1 Grade
Exam 2 Grade Homework Grade Final Exam Grade For each student, your program
should first calculate a final grade, using this formula:Final Grade = 0.20 Exam 1 +
0.20 Exam 2 + 0.35 Homework + 0.25 Final Exam Then assign a letter grade on
the basis of 90100 = A, 8089 = B, 7079 = C, 6069 = D, andless than 60 = F. All the
information, including the final grade and the letter grade, is then displayed and written
to a file. We asked user for first name of Student then we asked for grades of student
Grade number then we Calculate students grade .Next we Display on screen name of
student Grades number entered Grade letter Ask for another student or quit Print file to
computer.
cout << "The letter Grade is A.";
CODE else if ( (x >= 90) && (x <=100))
cout << "The letter Grade is A";
//#include "stdafx.h" //the program work when else if (x == 80)
this line is FIRST in VS. cout << "The letter Grade B";
#include <iostream> //needed for use with input else if (( x >=80) && (x <90))
file cout << "The letter Grade is B";
#include <fstream> //needed for use with else if (x == 70)
output file cout << "The letter Grade C";
#include <cstdlib> //needed for exit() else if (( x >=70) && (x <80))
#include <string> cout << "The letter Grade is C";
#include <iomanip> // needed for formatting else if (x == 60)
using namespace std; cout << "The letter Grade D";
int main() else if (( x >=60) && (x <70))
{ cout << "The letter Grade is D";
char name [100];// Array else if (x == 50)
char quit; cout << "The letter Grade F";
quit ='\0'; else if (( x >=50) && (x <60))
while (quit !='q') cout << "The letter Grade is F";
{ else if (x == 40)
int a, b, d, f, x, z; //loads integers into memory cout << "The letter Grade F";
ofstream myfile; else if ( (x <40))
myfile.open ("Final Grade.txt"); cout << "The letter Grade is F";
cout <<"This is a Final Grade Calculator else
Program.\n " << endl; cout << "An invalid code was entered.";
cout <<"Please enter your first name?"<< endl; cout << endl;
cin >>name; myfile << "\n\tExam 1\tExam 2\tHomework
cout <<"Hello," << name << "."<< endl; \tFinal Exam"<<endl;
cout <<"Input your Grade number for Exam myfile<<""<<name<<"\t"<<a<<"\t"<<b<<"\t"<<d<
1:"<< endl; <"\t\t"<<f<<endl;
cin>> a; //Receives grade and loads it into myfile<<"Your Final grade is:"<<x<<endl;
memory cout<<""<< endl;
cout <<"Input your Grade number for Exam cout<<"q - Quit"<< endl;
2:"<< endl; cout<<"r - Repeat"<< endl;
cin>> b; cout<<"Please type in the letter for your choice
cout<<"Input your Grade number for then press enter." << endl;
Homeworks:"<< endl; cin>> quit;
cin>> d; cout << "Your file is saved as Final Grade .txt
cout<<"Input your Grade number for Final \nGoodbye," << name << "." << endl;
Exam:"<< endl; myfile.close();
cin>> f; }
z = ((0.20 * a) + (0.20 * b) + (0.35 * d) + (0.25 * return 0;
f)); //(starting division equation) }
x = z; //makes the x integer equal to z//pointer
cout<<"\n\tExam 1\tExam 2\tHomework \tFinal
Exam"<<endl;
cout<<""<<name<<"\t"<<a<<"\t"<<b<<"\t"<<d<<"
\t\t"<<f<<endl;
cout<<"Your Final grade is:"<<x<<endl;
if(x == 90)
BUILD
RUN

You might also like