Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This program must be written in Codeblocks and C++ /* This program reads an unknown number of records from an input file. Each record contains
This program must be written in Codeblocks and C++ /* This program reads an unknown number of records from an input file. Each record contains a student ID# (string), the student's semester average (double), and the letter grade earned (char). The program will determine how many students passed, how many failed and how many of each letter grade was assigned. It will then write to an output file the input values in tabular form followed by the 'calculated' values. Refer to the sample file output below. This program uses those functions described below. No arrays, structures, classes, or global variables were used in the solution of this problem. Input(file - prog5_25?inp.txt): student_id (string) semester_avg (double) semester_grd (char) Constants: PASSING_MIN_AVG (double) Output(console): (Sample Console Output) Authors' Names C.S.1428.25? Lab Section: L? --/--/-- The student information has been processed and saved to prog5_25?out.txt. Output (file - prog5_25?out.txt): Sample file output: Authors' Names C.S.1428.25? Lab Section: L? --/--/-- ID# Average Grade --------------------------- A12345678 47.50 F A98765432 69.50 C A00000000 74.80 W A01020304 19.75 I A10203040 91.00 A ... 22 student(s) received a passing grade. 3 student(s) received a failing grade. A B C D F W I 7 6 5 4 3 2 1 ====================================================================== The program is processed as follows: * A void function printIdInfo is called to write the authors' personal information (name, class/section number, lab section number, due date) on the first, second, third and fourth lines of the output file. * A void function printColumnHeaders is called to write to the output file two blank lines followed by underlined column headers for the table: ID# Average Grade * A void function getData is called to read from the input file the student ID#, the semester average, and the semester grade in this order. * As long as the student ID# is not "A0", the current record is processed as follows: * A void function passFailCount is called to determine how many students passed and how many failed. e.g. If the student did not withdraw or take an incomplete, If the semester average is passing, - pass_count is incremented otherwise (else) - fail_count is incremented Note: A grade of 59.5 or higher passes the class. * A void function gradeCount is called. gradeCount uses a switch statement to determine how many of each letter grade was assigned. (A's, B's, C's, D's, F's, W's, & I's) * A void function printStudentData is called to write to the output file the student ID#, the semester average, and the uppercase semester grade under the appropriate column headers. toupper and type casting are used. * The void function getData is called to read the next student ID#, semester average, and semester grade. * A void function printPassFailCount is called to write to the output file one blank line followed by the number of students who passed the course and the number of students who failed the course...in sentence form. * A void function printGradeCount is called to write to the output file one blank line followed by the column headers: A B C D F W I under which are written the number (count) of each letter grade assigned. * The function printIdInfo is called to write the authors' personal information (name, class/section number, lab section number, due date) to the console. * A void function printOutputFileNotice is called to write to the console two blank lines followed by a notice to users that the student information has been processed and stored to an output file. The name of the output file is indicated. ====================================================================== Notes: - Logical tests allow for upper or lower case letter grades. - Semester averages are formatted to two decimal places. - Student records are single-spaced on the output file. - All functions are fully documented. ======================================================================= */
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started