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
stealth61 [152]
3 years ago
12

Write a C++ program that computes student grades for an assignment as a percentage given each student's score and the total poin

ts. The final score must be rounded up to the nearest whole value using the ceil function in the header file and displayed as a percentage. You must also display the floating-point result up to 5 decimal places. You must use at least 2 functions: one to print the last name of the student and another function to compute and print the percentage as well as "Excellent" if the grade is greater than 90, "Well Done" if the grade is greater than 80, "Good" if the grade is greater than 70, "Need Improvement" if the grade is greater than or equal to 60, and "Fail" if the grade is less than 50. The main function is responsible for reading the input file and passing the appropriate arguments to your functions.
Computers and Technology
1 answer:
aivan3 [116]3 years ago
8 0

Answer:

See Explaination

Explanation:

/ Header files section

#include <iostream>

#include <fstream>

#include <iomanip>

#include <string>

#include <cmath>

using namespace std;

// start main function

int main()

{

// variables declaration

string fileName;

string lastName;

double score;

double total;

double grade;

string description;

// prompt the user to enter the input file name

cout << "Enter the input file name: ";

cin >> fileName;

// open the input file

ifstream infile;

infile.open(fileName);

// exit from the program if the input file does not open

if (!infile)

{

cout << fileName << " file cannot be opened!" << endl;

exit(1);

}

// repeat the loop for all students in the file

infile >> lastName;

while (infile)

{

infile >> score;

infile >> total;

// compute the grade

grade = score / total * 100;

// find the grade's description

if (grade > 90)

description = "Excellent";

else if (grade > 80)

description = "Well Done";

else if (grade > 70)

description = "Good";

else if (grade >= 60)

description = "Need Improvement";

else

description = "Fail";

// display the result of each student

cout << lastName << " " << setprecision(0) << fixed << round(grade) << "% " << setprecision(5) << fixed << (grade * 0.01) << " " << description << endl;;

infile >> lastName;

}

// close the input file

infile.close();

system("pause");

return 0;

} // end of main function

You might be interested in
Jeremy Bridges is an executive for Green Web Designs, where his primary role is to ensure the security of business systems and d
klasskru [66]

Answer:

Chief Security Officer

Explanation:

According to the given statement in the question the Jeremy's role in the company is "Chief Security Officer (CSO)".

The chief Security officer has the role of developing and looking on to the strategies and policies that are required for maintaining the operational, strategic, financial and reputational security  of the  overall company.

6 0
3 years ago
Write a setInterval() function that increases the count by 1 and displays the new count in counterElement every 300 milliseconds
Alina [70]

Answer:

  1. var count = 0;
  2. var counterElement = document.getElementById("counter");
  3. counterElement.innerHTML = count;
  4. var a = setInterval(
  5.    function(){  
  6.        count++;
  7.        counterElement.innerHTML = count;
  8.        if(count == 5){
  9.            clearInterval(a);
  10.        }
  11.    }
  12.        , 300);

Explanation:

The solution code is given from Line 6 - 15.  

setInterval function is a function that will repeatedly call its inner function for an interval of time. This function will take two input, an inner function and the interval time in milliseconds.  

In this case, we define an inner function that will increment count by one (Line 8) and then display it to html page (Line 9). This inner function will repeatedly be called for 300 milliseconds. When the count reaches 5, use clearInterval to stop the innerFunction from running (Line 11 - 13).  

8 0
3 years ago
What is the output of the following code?
Lynna [10]

Answer:

The output is 24

Explanation:

Given

The above code segment

Required

The output

We have (on the first line):

x = 6

y = 3

z=24

result=0

On the second line:

result = 2*((z/(x-y))\%y+10)

Substitute the value of each variable

result = 2*((24/(6-3))\%3+10)

Solve the inner brackets

result = 2*((24/3)\%3+10)

result = 2*(8\%3+10)

8%3 implies that, the remainder when 8 is divided by 3.

The remainder is 2

So:

result = 2*(2+10)

result = 2*12

result = 24

<em>Hence, the output is 24</em>

8 0
3 years ago
A person who breaks into a computer, network, or online site is called
dybincka [34]

Answer:

B: Hacker

Explanation:

literally anything else aren't even real things besides hacker.

5 0
3 years ago
Read 2 more answers
To rearrange the data on your hard disk so your computer can run more efficiently, you use ____.
Ratling [72]
A disk optimization program, but they're probably looking for defragmenting program.
5 0
3 years ago
Other questions:
  • What are the three basic classes of application
    14·2 answers
  • Which operating system (OS) is used to run your laptop?
    15·2 answers
  • Need the answer ASAP!!!
    14·1 answer
  • 1. Software that is designed to intentionally cause harm to a device, server, or network is A. outware B.loggerware C.
    12·1 answer
  • Suppose you want to boot a VM from its virtual DVD drive, but it boots to the VM’s hard drive. Which of the following could be t
    12·1 answer
  • What are some common uses of Excel?
    10·1 answer
  • Which Excel function or tool will you use to display the cells that are referred to by a formula in the selected cell
    8·1 answer
  • HURRRY WILLL GIVE BRAINLIST!!!!!!
    12·1 answer
  • How do we ensure that future technologies are fair to society?
    11·1 answer
  • Which option should Gina click to edit the text contained in a text box on a slide in her presentation?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!