Help with c++ grading program.

I need help on a C++ program!?

  • I'm working on the following assignment and could use some help: A teacher has five students who have taken four tests.The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores: Test Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69 D 0-59 F Write a class that uses a string array or an ArrayList object to hold the five students' names, an array of five characters to hold the five students' letter grades, and five arrays of four doubles each to hold each student's set of test scores. The class should have methods that return a specific student's name, average test score, and a letter grade based on the average. Demonstrate the class in a program that allows the user to enter each student's name and his or her four test scores. It should then display each student's average test score and letter grade. Input validation: Do not accpet test scores less than zero or greater than 100. I need this one answered pls!!! I did all my other programs and have a ton of work to catch up on!!!! If some 1 could help I would appreciate it!!! and Can some some1 also tell me if this program is right!! The Problem states: Write a program that asks the user for a file name. Assume the file contains a series of numbers, each written on a separate line. The program should read the contents of the file into an array, then displays the following data: - The lowest number in the array. - The highest number in the array. - The total of the numbers in the array. - The average of the numbers in the array. #include <iostream> #include <fstream> using namespace std; // Function prototypes int getHighest(int[], int); int getLowest(int[], int); int getSum(int[], int); int getAverage(int[], int); int main() { const int ARRAY_SIZE = 12; // Array size. int numbers[ARRAY_SIZE]; // Array with 10 elements. int AVERAGE; // To hold average of the values. int count; // Loop counter. int highest; // To hold highest value. int lowest; // To hold lowest value. int sum; // To hold total of sum. ifstream inputFile; // Input file stream object. inputFile.open("numbers.txt"); // Open the file. // Read the 10 numbers from the file into the array. for (count = 0; count < ARRAY_SIZE; count++) inputFile >> numbers[count]; // FIND the HIGHEST value. highest = getHighest(numbers, ARRAY_SIZE); // DISPLAY the HIGHEST value. cout << "The Highest Value is: " << highest << endl; // FIND the LOWEST value. lowest = getLowest(numbers, ARRAY_SIZE); // DISPLAY the LOWEST value. cout << "The Lowest Value is: " << lowest << endl; // FIND the SUM of the values. sum = getSum(numbers, ARRAY_SIZE); // DISPLAY the SUM of the values. cout << "The Total Sum is: " << sum << endl; // Find the Average of the values. AVERAGE = getAverage(numbers, ARRAY_SIZE); // DISPLAY the AVERAGE of the values. cout << "The Average is: " << AVERAGE << endl; // Close the file inputFile.close(); return 0; } //************************************... //* Definition of function getLowest * //* This function gets the lowest value of * //* the array * //************************************... int getLowest(int numbers[], int ARRAY_SIZE) { int lowest; lowest = numbers[12]; for (int count = 1; count < ARRAY_SIZE; count++) { if (numbers[count] < lowest) lowest = numbers[count]; } return lowest; } //************************************... //* Definition of function getHighest * //* This function gets the Highest value of* //* the array * //************************************... int getHighest(int numbers[], int ARRAY_SIZE) { int highest; highest = numbers[12]; for (int count = 1; count < ARRAY_SIZE; count++) { if (numbers[count] > highest) highest = numbers[count]; } return highest; } // ************************************ // * Definition of Function getSum * // * This function gets the total of * // * numbers within the array and * // * adds them up using a loop. * // ************************************ int getSum(int numbers[], int ARRAY_SIZE) { int total = 0; // Initialize accumulator. for (int count = 0; count < ARRAY_SIZE; count++) total += numbers[count]; return total; } // **************************************** // * Definition of Function getAverage * // * This function calculates the average * // * of all the values within the array * // * Using a loop * // **************************************** int getAverage(int numbers[], int ARRAY_SIZE) { int total = 0; // Initialize Accumulator int average; // To hold the average for (int count = 0; count < ARRAY_SIZE; count++) total += numbers[count]; average = t

  • Answer:

    ASK a question. = "I need this one answered pls!!!" State what you want answered!

Ziggs at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Standard Answer to a posted homework assignment usually is: Show us your code. Point out where you fail. Phrase your question. You provide code - fully functional - not pertaining to the homework assignment you posted and I wonder whether it makes sense at all to provide an answer under these circumstances. Well, here is the code supporting your quest: http://ideone.com/MzOFV Have fun ...

MichaelInScarborough

ASK a question. = "I need this one answered pls!!!" State what you want answered!

tbshmkr

The code what you given is running and correct

James Bond

Standard Answer to a posted homework assignment usually is: Show us your code. Point out where you fail. Phrase your question. You provide code - fully functional - not pertaining to the homework assignment you posted and I wonder whether it makes sense at all to provide an answer under these circumstances. Well, here is the code supporting your quest: http://ideone.com/MzOFV Have fun ...

MichaelInScarborough

The code what you given is running and correct

James Bond

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.