1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
iren [92.7K]
3 years ago
13

Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed

by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and 100), and grade of type char. Suppose that the class has 20 students. Use an array of 20 components of type studentType. Your program must contain at least the following functions: A function to read the students’ data into the array. A function to assign the relevant grade to each student. A function to find the highest test score. A function to print the names of the students having the highest test score. Your program must output each student’s name in this form: last name followed by a comma, followed by a space, followed by the first name; the name must be left justified. Moreover, other than declaring the variables and opening the input and output files, the function main should only be a collection of function calls.
Computers and Technology
1 answer:
bekas [8.4K]3 years ago
5 0

Answer:

See explaination

Explanation:

#include <iostream>

#include <iomanip>

#include <fstream>

#include <string>

using namespace std;

void readStudentsData();

void levels(int&,int&,int&);

int main()

{

string studentsName[50];

int grade[50];

int highestScore = 0;

int belowAverage = 50;

int countStudents = 0;

int sum = 0;

int score[5]=

double average = 0;

ifstream infile;

ofstream outfile;

void readStudentsData();

infile.open("c:\\Data.txt");

int numOfStudents = 0;

infile >> studentsName[numOfStudents] >> grade[numOfStudents];

While (infile && numOfstudents < 50)

{

numOfStudents++;

infile >> studentsName[numOfStudents] >> grade[numOfStudents};

}

if (!infile)

{

cout << "File does not open." << endl;

return 1;

}

outfile.open("c:\\average.out");

outfile << fixed << showpoint;

outfile << setprecision(2);

infile >> studentsName;

infile >> score1 >> score2 >> score3 >> score4 >> score5 >>;

outfile << left << setw(20) << "Students Name"

<< setw(5) << "Score 1" << setw(5) << "Score 2"

<< setw(5) << "Score 3" << setw(5) << "Score 4"

<< setw(5) << "Score 5" << setw(5) << "Grade"

<< setw(5) << "Average" << setw(5) << "Below average"

<< setw(5) << "Highest" << endl;

if (average >= 90)

cout << "A" << endl;

else if (average >= 80)

cout << "B" << endl;

else if (average >= 70)

cout << "C" << endl;

else if (average >= 60)

cout << "D" << endl;

else

cout << "F" << endl;

}

average = static_cast<double>(score1+score2+score3+score4+score5) /5;

void level(int &highestScore,int &belowAverage,int &sum);

{

int level,high = 0,low = 17;

infile >> level;

while(level!=-1)

{

sum = sum + level;

if (level > high)

{

high = level;

infile >> level;

}

else

if (level < low)

{

low = level;

infile >> level;

}

else

if infile >> level;

}

outfile << ' ' << high;

else

if (high > highestScore)

highestScore=high;

else

if (low < belowAverage)

belowAverage=low;

}

do

{

cout << "Students Name: ";

cin >> name

cout << "Input score: " << endl;

cin >> score1>> score2>> score3>> score4>> score5;

cout << Students Name << Highest score);

}

While (highest score !=0);

infile.close();

outfile.close();

return 0;

}

You might be interested in
What type of malware is heavily dependent on a user in order to spread?
frosja888 [35]
The answer is " Virus" !
5 0
3 years ago
Gary has to complete a form before enrolling into an online course. A few of the fields require Gary to respond with either a "Y
zalisa [80]
I think its C. Boolean
Hope this helped!
3 0
3 years ago
Read 2 more answers
Design and implement an application that reads a string from the user then determines and prints how many of eachlowercase vowel
frez [133]
Design and implement an application that reads a string from the user, then determines and prints how many of each lowercase vowel (a, e, i, o, and u) appear in the entire string . Have a separate counter for each vowel. Also count and print the number of nonvowel characters .

SPECIFICATION OF PROMPTS, LABELS AND OUTPUT : Your code should use the prompt "enter string : ". After the input is read, there are six lines of output , each starting with a different label: "a: ", "e: ", "i: ", "o: ", "u: ", "other: " in that order. After each label is the required count.

For example: if "aardvark heebie jeebies" were read in,
4 0
2 years ago
Melissa is the network administrator for a small publishing company. as network administrator, she is in charge of maintaining t
Arte-miy333 [17]
The answer is an Intruder Prevention System (IPS). An Intrusion Detection System (IDS) will detect an attack but will not block it.
3 0
3 years ago
Please help
ExtremeBDS [4]

Answer:

Answered below

Explanation:

This solution is written in Kotlin programming language.

fun average (a: Int, b: Int, c: Int, d: Int, e: Int) : Double {

#variable to hold the addition of all parameters

var sum = a + b + c + d + e

#variable to hold the average of sum

var avg = sum / 5

return avg

}

#call the function to see how it works.

# this operation is done in the fun main()

var test: Double = average ( 5, 4, 7 , 3, 9)

print (test)

8 0
3 years ago
Other questions:
  • "Server Manager will allow you to manage all roles and features installed on any server, and view the status of all your servers
    7·1 answer
  • 24 bit or 16 million colors is often called?
    7·1 answer
  • You can access various sites on the WWW by using hyperlinks or by
    14·1 answer
  • In ssl/tls, a specific set of protocols that a particular cryptographic system will use to provide protection is called a ______
    5·1 answer
  • 6. A distribution consists of three components with frequencies 200, 250 and 300 having means
    14·1 answer
  • Assuming that t is an array and tPtr is a pointer to that array, which expression refers to the address of element 3 of the arra
    7·1 answer
  • If metal shims are used for alignment adjustment in the front, they adjust ________.
    5·1 answer
  • You have just connected a new computer to your network. The network user static IP addressing. You find that the computer can co
    12·2 answers
  • What is a Software that interprets commands drom the keyboard and mouse
    13·1 answer
  • A device that make it possible for a muitiple customer to share one address is called
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!