yeah the assignment is dealing with functions, been having problems getting them to work.
this is what is have now. sorry of the novel here btw.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#include<iostream> //Header File for console I/O
#include<iomanip>
#include<fstream>
#include<string>
#include<cmath>
using namespace std;
void display();
bool pass_fail ();
double grade(char, double);
// begin min Function Definition
int main()
{
ifstream inputFile("My grades.txt");
string first, last, line;
char again;
double Test_Scores, Test_Scores2, assignment1, assignment2, assignment3, assignment4, class_attendance, average;
// Display Identtification on screen
cout << "assignement 5" << endl;
cout << "Programmed by Paul Duckworth" << endl;
do
{
display();
while(inputFile >> first >> last >> Test_Scores >> Test_Scores2 >> assignment1 >> assignment2 >> assignment3 >> assignment4 >> class_attendance){
cout << "Student name: "<<first << " "<< last << endl;
cout << "Test Scores and Assignment Scores: " <<Test_Scores << " " << Test_Scores2 << " "
<< assignment1 << " " << assignment2 << " "<< assignment3 << " "<< assignment4 << endl;
cout << "Class attendence: "<< class_attendance << endl;
cout << "Final Average: "<< average << endl;
cout << "Grade: " << endl;
cout << "Pass or fail: " << endl;
}
inputFile.close();
cout << "do you want to rocess another student? (Y/N) ";
cin >> again;
} while(again == 'Y' || again == 'y');
return 0;
//*********************************************
//Displays header
//
//*********************************************
void display();
{
cout << " Students Grade Point Averages: " << endl;
}
//*************************************************************
//Determine if student pass failed by counting the attendence,
// assignment and test scores
//
//*************************************************************
bool pass_fail(char grade )
{
if (grade >= 60 == Pass)
{
bool status;
status = true;
}
else
if (grade < 60 == Fail)
status = false;
return status;
}
}
//************************************************************
//Calculate grade averages
//
//
//************************************************************
double grade(double average)
{
average = (Test_Scores + Test_Scores2 + assignment1 +
assignment2 + assignment3 + assignment4 + class_attendance)/ 3;
} //end of main function.
| |
************************************************
heres the rest of the assignment requirements if it helps:
The teacher's class policy is that students are required to take two tests and complete 4 assignments. All four of those assignments together bear as much weight on the final grade as a single test (hint: add the assignments and then average with tests). You will also need to determine if the student has met minimum requirements for passing the class and their final grade. Minimum requirements involve attendance and minimum grade performance - if the student has attended less than 20 classes, it is an automatic failure. If a student's grade average is lower than 60%, the student is considered to have failed also, no matter how many classes they attended.
The teacher wants to see (on the monitor) for each student, the following:
First name and Last Name
Test Scores and Assignment Scores
Final average
Letter grade corresponding to the final average (use normal grading scale)
A message letting him know if they pass or fail or fail due to attendance
Format the output so the information is displayed in an attractive and readable manner.
Your program should do the following:
Initialize the environment.
Open the data file (file can be found here). Save this file in the same folder where you store your program.
Process one record at a time using a loop.
Perform proper cleanup after all the records are processed.
Other Requirements:
1. The program must handle a completely variable number of students. My grades.txt file could have one student or it could have 40 or somewhere in between. I may test your program with a different number of students than you use for testing.
2. The program must have three functions other than main. Please include the following functions:
a) An output function that creates the report header.
b) A function that calculates the student’s average.
c) A function that determines whether the students pass or fail.
Only one function may be a void function or have an empty parameter list. In other words, you need functions that are passing things in and out. Try to use reference parameter(s) if you need to return more than one value from a function.
Absolutely no global functions.
**************************************************
Heres what i can compille so far.
assignement 5
Programmed by Paul Duckworth
Student name: Fred Farkle
Test Scores and Assignment Scores: 72 69 17 21 23 14
Class attendence: 22
Final Average
Grade:
Pass or fail:
Student name: Tina Moffett
Test Scores and Assignment Scores: 81 86 23 25 19 25
Class attendence: 28
Final Average
Grade:
Pass or fail:
Student name: Lois Lepler
Test Scores and Assignment Scores: 98 91 25 23 24 21
Class attendence: 25
Final Average
Grade:
Pass or fail:
Student name: Brett Lyons
Test Scores and Assignment Scores: 61 56 21 14 18 23
Class attendence: 20
Final Average
Grade:
Pass or fail:
Student name: Alex Stark
Test Scores and Assignment Scores: 81 72 19 23 21 12
Class attendence: 21
Final Average
Grade:
Pass or fail:
Student name: Sandy Reardon
Test Scores and Assignment Scores: 78 81 22 19 25 17
Class attendence: 29
Final Average
Grade:
Pass or fail:
Student name: Jordan Taglauer
Test Scores and Assignment Scores: 66 52 17 15 19 21
Class attendence: 18
Final Average
Grade:
Pass or fail:
Student name: Rhonda Bellamy
Test Scores and Assignment Scores: 91 92 23 24 21 19
Class attendence: 22
Final Average
Grade:
Pass or fail:
Student name: Connor Sellers
Test Scores and Assignment Scores: 78 83 22 25 19 21
Class attendence: 21
Final Average
Grade:
Pass or fail:
Student name: Alice Legrow
Test Scores and Assignment Scores: 99 73 21 18 16 26
Class attendence: 19
Final Average
Grade:
Pass or fail:
Student name: Paul Richards
Test Scores and Assignment Scores: 78 56 12 16 18 13
Class attendence: 22
Final Average
Grade:
Pass or fail:
Student name: Adam Soleski
Test Scores and Assignment Scores: 87 65 17 17 23 16
Class attendence: 24
Final Average
Grade:
Pass or fail:
Student name: April Lanford
Test Scores and Assignment Scores: 77 83 21 23 20 19
Class attendence: 28
Final Average
Grade:
Pass or fail:
Student name: Bruce Wagner
Test Scores and Assignment Scores: 89 90 20 20 19 24
Class attendence: 29
Final Average
Grade:
Pass or fail:
Student name: Leslie Gore
Test Scores and Assignment Scores: 56 87 14 21 17 23
Class attendence: 24
Final Average
Grade:
Pass or fail:
Student name: George Whittaker
Test Scores and Assignment Scores: 66 77 20 20 17 23
Class attendence: 25
Final Average
Grade:
Pass or fail:
do you want to rocess another student? (Y/N) Scores and Assignment Scores: 87 65 17 17 23 16
--------------------------------
Process exited after 4.344 seconds with return value 0
Press any key to continue . . .