Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to read in a collection of exam scores ranging in value from 0 t

ID: 3543954 • Letter: W

Question

Write a program to read in a collection of exam scores ranging in value from 0 to 100. Your program should display the category of each score. It should also count and display the number of outstanding scores (90 to 100), the number of satisfactory scores (60 to 89), and the number of unsatisfactory scores (0 to 59).  Your program should display the average score at the end of the run. Your program should ensure that each score is valid (in the range 0 to 100).

Chapter 5 Programming Project Analysis and Design Sheet

Program Inputs:

Program Outputs:

(Repeat this section for each of your functions). Provide the function prototype here.

Function Analysis:

Write a program to read in a collection of exam scores ranging in value from 0 to 100. Your program should display the category of each score. It should also count and display the number of outstanding scores (90 to 100), the number of satisfactory scores (60 to 89), and the number of unsatisfactory scores (0 to 59). Your program should display the average score at the end of the run. Your program should ensure that each score is valid (in the range 0 to 100). Chapter 5 Programming Project Analysis and Design Sheet Program Analysis: Program Inputs: Program Outputs: Program Algorithm: Program Test Plan: Program Test Results: Functions (Repeat this section for each of your functions). Provide the function prototype here. Function Analysis: Function Preconditions and Post Conditions: Function Inputs and Outputs: Function formulas: Function Algorithm:

Explanation / Answer

#include <fstream>

#include <iostream>

#include <conio.h>

using namespace std;


#define in_file "examdata.txt"


int main()

{

ifstream ins;

int marks;

int numofOutstandingScore=0, numOfSatisScore=0, numOfUnsatisfacScore=0,totalNumScores=0,numinvalidSore=0;

int avg,total=0;

char next_char;

ins.open(in_file);

cout<<"Marks "<<"Remarks"<<endl;

while (!ins.eof())   

{

ins >> marks;   

ins.get(next_char); // echo print input to screen

cout<<marks<<" ";

//price range check.

totalNumScores++;

if(marks>100||marks<0)

{

cout<<"This marks range is invalid"<<endl;

numinvalidSore++;

continue;

}

else if(marks>=90)

{

cout<<"outstanding scores";

numofOutstandingScore++;

}

else if(marks>=60)

{

cout<<"satisfactory scores";

numOfSatisScore++;

}

else

{

cout<<"unsatisfactory scores";

numOfUnsatisfacScore++;

}

total+=marks;

cout<<endl;

}

avg = total/(totalNumScores-numinvalidSore);

//summary Table

cout<<"SUMMARY TABLE:"<<endl;

cout<<"total number of outstanding scores = "<<numofOutstandingScore<<endl;

cout<<"total number of satisfactory scores "<<numOfSatisScore<<endl;

cout<<"total number of unsatisfactory score "<<numOfUnsatisfacScore<<endl;

cout<<"total number of Invalid score "<<numinvalidSore<<endl;

cout<<"Total number of exam scores"<<totalNumScores<<endl;

cout<<"Avarage score of a student :"<<avg<<endl;

getchar();

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote