Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Modify the Test Scores program from the code below Section into a class grade book that includes a class of up to 20 students and 3 test grades. Each test is read in as a separate file, so 3 Test files are required.

The students' grades should be kept in an array.

Once all three test scores are read in, calculate each student's average and grade for the class.

Also print a report of the each student's test grades, average and final grade as a table, and then print the averages of each Test and overall Test Average, as well as highest Test Grade of all Tests and the student with the highest class grade.

 

#include

#include

#include

 

using namespace std;

void readData(ifstream& inputFile, int list[], int size);

void holdscrn( );    

void print(int list[], int size);

int main()

{

    int scores[8] = {0};

    ifstream infile;

    infile.open("Test.txt");

    if (!infile) // need to add ! for not successful open

    {

        cout << "Cannot open the input file. Program terminates!"

             << endl;

        holdscrn( );   // Hold screen before exit    

        return 1;

    }

    readData(infile, scores, 8);

    print(scores, 8);

  cout << endl;

    infile.close();

    holdscrn( );   // Hold screen before exit

    return 0;

}

void readData(ifstream& inputFile, int list[], int size)

{

    int score;

    int index;

    inputFile >> score;

    while (inputFile)

    {

        index = score / 25;

        if (index == size)

            index--;

        if (index < size)

                list[index]++;

        inputFile >> score;

    }

    return;

}

void print(int list[], int size)

{

    int range;

    int lowRange = 0;

    int upperRange = 24;

    cout << "   Range # of Students" << endl;

    for (range = 0; range < size; range++)

    {

        cout << setw(3) << lowRange << " - "

             << upperRange << setw(15)

             << list[range] << endl;

        lowRange = upperRange + 1;

        upperRange = upperRange + 25;

        if (range == size - 2)

            upperRange++;

    }

    cout << endl;

    return;

}

void holdscrn( )   // void function to hold screen open before exit

{

    char holdscreen;

    cout << "\n\n\tEnter one character and press return to exit program: ";

    cin >> holdscreen;

    return;

}

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9887760

Have any Question?


Related Questions in Computer Engineering

Question suppose that incoming packets are encrypted with a

Question : Suppose that incoming packets are encrypted with a symmetric key that only the sender and receiver know. Which type(s) of firewall will work with such packets and which will not? Why? Note: Some specific answe ...

Explain that when an unauthorized individual gains access

Explain that when an unauthorized individual gains access to the information an organization trying to protect, that act is categorized as a deliberate act of espionage or trespass.

The next four questions are based on the following you

The next four questions are based on the following: You invested a lump sum of $50,000 in a new company ten years ago and left it there without any further investments and now, today, the company listed on the stock exch ...

Suppose you are a manager in the it department for the

Suppose you are a manager in the IT department for the government of a corrupt dictator, who has a collection of computers that need to be connected together to create a communication network for his spies. You are given ...

Do you need computers or information and communication

Do you need computers or information and communication technologies to store, organize, and manage data in organizations? Explain how the present day organizations in a developed country like the USA store and manage the ...

Question do a research on the internet and discuss about

Question : Do a research on the Internet and discuss about the history of development of the networking field. Also discuss some of the recent trends in the networking area, (approx 200 words)

Sheridan company plans to introduce a new product and is

Sheridan Company plans to introduce a new product and is using the target cost approach. Projected sales revenue is $1770000 ($6.00 per unit) and target costs are $1563500. What is the desired profit per unit? $0.70 $3.0 ...

Discuss honeypots are they legal should they be legal what

Discuss honeypots. Are they legal? Should they be legal? What are some of the potential problems for those implementing a honeypot?

Students will create an application that allows the user to

Students will create an application that allows the user to create entities with a dialog window that will be displayed by a ListView in a separate dialog. The main dialog will keep track of how many windows and entities ...

What is the binary representation of the decimal number

What is the binary representation of the decimal number 4.875 assuming the IEE 754 single precision format?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As