Trying to figure C++ program coding using the following:    File IO    Control structures    Looping    Operator precedence    Error checking (bad data, filestream fail state, etc.)    Use of proper data types; type coersion and/or explict type conversion   Exact output Write a program that will calculate numerical and letter grades for a student and output a report: The information will be in the provided data file txt. The data file consists of several rows of data containing a student name and information for 3 types of assignments: First Name, Last Name, number of homework grades, values for homework grades, percentage of total grade, number of program grades, values for program grades, percental of total grade, number of exam grades, values for exam grades, percentage of exam grades.  For example, the first row of the data file contains the following: Sherlock Holmes 3 100 100 100 0.15 3 75 80 90 0.40 3 60 70 70 0.45 The student, Sherlock Holmes, has three homework grades, each with a value of 100.  Homework is 15% of total grade.  He has three program grades with values of 75, 80, 90.  Program is 40% of grade.  He has three exam grades of 60, 70, 70.  Exams are 45% of grade. Request the name of the input file from the user. Do not “hard-code” the file name in the program.  Check to ensure the input file opens.  If it does not open, display an appropriate message to the user and exit the program. Using a looping construct, read until end of file. Do not hard code the number of rows in the loop.  The file must be read using an outer loop and three inner/nested loops to read all the data properly.  The first number will aid in determining the NUMBER of grades to read.  Do NOT assume there will be only 3 values in each category.  Code for a variable number of values in each category. The maximum points for each assignment, homework and exam are 100. The maximum points for each may be calculated by multiplying the number of assignments in the group by 100.  Calculate final grade using the following formula:  ((total HOMEWORK Points earned/maximum HOMEWORK points) * percent of total grade) + (total PROGRAM Points earned/maximum PROGRAM points) * percent of total grade) + (total EXAM Points earned/maximum EXAM points) * percent of total grade)) * 100 Use the final numerical grade to look up corresponding letter grade as follows: 90 - 100 = A 80 -  89 = B 70 -  79 = C 60 -  69 = D <  60 = F Use the final letter grade to look up a "witty" comment of your choice, using a SWITCH statement. A statement must be output for each letter grade above.  For example: A = "Most excellent work” B = "IMHO You Passed" C="Got to be quicker than that" D= "Dog gone try harder" F= "Try again next time"   Request an output file name from the user. Do not “hard-code” the file name in the program.  Check to ensure the output file opens.  If it does not open, display an appropriate message to the user and exit the program. For each student, output the following to the console (screen) and the output file in a neat, readable format. Output each input line on one output line.  Use manipulators to output values in readable columns: Student Name, Total Points (numerical grade):  NN.  Letter Grade: X.  Depending on letter grade, The witty comment.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Trying to figure C++ program coding using the following:

   File IO

   Control structures

   Looping

   Operator precedence

   Error checking (bad data, filestream fail state, etc.)

   Use of proper data types; type coersion and/or explict type conversion

  Exact output

Write a program that will calculate numerical and letter grades for a student and output a report:

  1. The information will be in the provided data file txt. The data file consists of several rows of data containing a student name and information for 3 types of assignments:

First Name, Last Name, number of homework grades, values for homework grades, percentage of total grade, number of program grades, values for program grades, percental of total grade, number of exam grades, values for exam grades, percentage of exam grades.  For example, the first row of the data file contains the following:

Sherlock Holmes 3 100 100 100 0.15 3 75 80 90 0.40 3 60 70 70 0.45

The student, Sherlock Holmes, has three homework grades, each with a value of 100.  Homework is 15% of total grade.  He has three program grades with values of 75, 80, 90.  Program is 40% of grade.  He has three exam grades of 60, 70, 70.  Exams are 45% of grade.

  1. Request the name of the input file from the user. Do not “hard-code” the file name in the program.  Check to ensure the input file opens.  If it does not open, display an appropriate message to the user and exit the program.
  2. Using a looping construct, read until end of file. Do not hard code the number of rows in the loop.  The file must be read using an outer loop and three inner/nested loops to read all the data properly.  The first number will aid in determining the NUMBER of grades to read.  Do NOT assume there will be only 3 values in each category.  Code for a variable number of values in each category.
  3. The maximum points for each assignment, homework and exam are 100. The maximum points for each may be calculated by multiplying the number of assignments in the group by 100.  Calculate final grade using the following formula:

 ((total HOMEWORK Points earned/maximum HOMEWORK points) * percent of total grade) + (total PROGRAM Points earned/maximum PROGRAM points) * percent of total grade) + (total EXAM Points earned/maximum EXAM points) * percent of total grade)) * 100

  1. Use the final numerical grade to look up corresponding letter grade as follows:

90 - 100 = A

80 -  89 = B

70 -  79 = C

60 -  69 = D

<  60 = F

  1. Use the final letter grade to look up a "witty" comment of your choice, using a SWITCH statement. A statement must be output for each letter grade above.  For example:

A = "Most excellent work”

B = "IMHO You Passed"

C="Got to be quicker than that"

D= "Dog gone try harder"

F= "Try again next time"

 

  1. Request an output file name from the user. Do not “hard-code” the file name in the program.  Check to ensure the output file opens.  If it does not open, display an appropriate message to the user and exit the program.
  2. For each student, output the following to the console (screen) and the output file in a neat, readable format. Output each input line on one output line.  Use manipulators to output values in readable columns:

Student Name, Total Points (numerical grade):  NN.  Letter Grade: X.  Depending on letter grade, The witty comment.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education