Hello good afternoon,This is my first time using Bartleby, I am super slow in computer science and I am wondering if you please can help me to be very specific and explanative as possible with the following problem. to be honest, I don't even know how to start.Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the header file. You must also display the floating-point result of up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by a space.In addition, you must print to the console “Excellent” if the grade is greater than or equal to 90, “Well Done” if the grade is less than 90 and greater than or equal to 80, “Good” if the grade is less than 80 and greater than or equal to 70, “Need Improvement” if the grade is less than 70 and greater than or equal to 60, and “Fail” if the grade is less than 60.

Question
Asked Sep 18, 2019
333 views

Hello good afternoon,

This is my first time using Bartleby, I am super slow in computer science and I am wondering if you please can help me to be very specific and explanative as possible with the following problem. to be honest, I don't even know how to start.

Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the header file. You must also display the floating-point result of up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by a space.

In addition, you must print to the console “Excellent” if the grade is greater than or equal to 90, “Well Done” if the grade is less than 90 and greater than or equal to 80, “Good” if the grade is less than 80 and greater than or equal to 70, “Need Improvement” if the grade is less than 70 and greater than or equal to 60, and “Fail” if the grade is less than 60.

check_circle

Expert Answer

Step 1

Program instructions:

  • Declare necessary variables.
  • Open the file with the score and total points and read the data.
  • Calculate the percentage and use ceil() function to round up the score from the file.
  • Use printf() function to print the floating point result up to 5-decimal places as well.
  • Use if-else statements to print the message with the grade.
Step 2

Program:

#include <iostream>

#include <cmath>

#include <fstream>

#include <iomanip>

using namespace std;

int main ()

{

     //input variables

     float score;

     float TotalPoints;

     float GradePercent;

    

     ifstream inData;

    

     // open file

     inData.open ("Grades.txt");

    

     // read values

     inData >> score >> TotalPoints;

    

     //calculate percentage

    

     GradePercent = ceil(score) / TotalPoints * 100;

    

     // print the results

     cout << "You got "<<GradePercent<<"% ";

     printf("%.5f",GradePercent/100);

     cout<<" ";

     // assign and print the grades

    

     if (GradePercent > 90)

     {

     cout<< "Excellent"<<endl;

     }

     else if (GradePercent > 80)

     {

     cout<< "Well Done"<<endl;

     }

     else if (GradePercent > 70)

     {

     cout<< "Good"<< endl;

     }

     else if (GradePercent >= 60)

     {

     cout<< "Need Improvement"<< endl;

     }

     else if (GradePercent < 50)

     {

     cout<< "Fail"<< endl;

     }

    

     return 0;

}

Step 3

File Grades.txt:

...
help_outline

Image Transcriptionclose

Grades.bxt-Notepad File Edit Format View Help 78.1356 100

fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Using the following truth table, write the equivalent Boolean equations in Sum of Product and Produc...

A: Simplification of Sum Of Products (SOP):The truth table of the SOP is as follows

question_answer

Q: Show that the following grammar is ambiguous: S→AB|aaaB,A→a|Aa,B→b.

A: A grammar is known as ambiguous when there is more than one derivation tree (right most derivation t...

question_answer

Q: Programming in C language.

A: In order to implement the question mentions a method called getChoice() information about which has ...

question_answer

Q: What is the best way to pass 2D arrays to a function? (C++) For my program, I have a 2D array (size:...

A: There are two ways to pass 2-D array to a function either by sending the array name in the function ...

question_answer

Q: In C++ Create a function called ApplyTax. The tax rate should be a const set to 8.75%.  ApplyTax sho...

A: Program designThe program has 3 parts – main function, ApplyTax function and TotalCost functionthere...

question_answer

Q: Show the hexadecimal representation for the phrase "  University of Akron."

A: Conversion steps:Initially, write the ASCII value of each character in the phrase in binary represen...

question_answer

Q: Create the physical level ERD.  I believe my physical level ERD is missing several parts. However, t...

A: Hey.....The actual design of database can be represented  by  physical E- R   diagrams.Physical ERD ...

question_answer

Q: Develop the ‘Shape’ application such that: Implement an array of objects of various types (all SIX ...

A: Program plan: Define a class called “Shape”.Define a default constructor to print the message.Define...

question_answer

Q: 1. /15 points] Consider the following function: Func1(A, n) * A is an array of integers 1 80; 2 for ...

A: a)Worst case running time of Func1:The random number between 1 to “n” is assigned to “k” in the give...