Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A : Program Description: Write a program to generate a report based on input received from a text file. Suppose the input text file

image text in transcribed

Part A :

Program Description:

Write a program to generate a report based on input received from a text file. Suppose the input text file student_grades.txt contains the students Last name , First name, SSN, Test1, Test2, Test3 and Test4.

i.e.

Alfalfa Aloysius 123-45-6789 40.0 90.0 100.0 83.0

Generate the output Report File student_final.txt in the following format :

LastName FirstName SSN Test1 Test2 Test3 Test4 Average FinalGrade

i.e.

Alfalfa Aloysius 123-45-6789 40.0 90.0 100.0 83.0 78.25 .0 C+

The program must be written to use the enum letterGrade :

enum letterGrade {A_PLUS,A, A_MINUS,B_PLUS,B, B_MINUS, C_PLUS,C, C_MINUS,D_PLUS,D, D_MINUS,F } ;

Use the following function prototype for deriving letter grade :

letterGrade deriveGrade(double average) ;

The average is calculated as follows : (test1 + test2 + test3 + test4)/4.0

The function deriveGrade should derive the letterGrade of the student based on the following grading scale :

Letter Grade

Percentage

A+

97%+

A

93%-96%

A-

90%-92%

B+

87%-89%

B

83%-86%

B-

80%-82%

C+

77%-79%

C

73%-76%

C-

70%-72%

D+

67%-69%

D

63%-66%

D-

60%-62%

F

0%-59%

Also provide the following function :

string convertToText(letterGrade grade) ; //This function converts a letterGrade type to a string type.

Requirement :

  • The namespace gradeOpt definition should contain the following members
    1. the enum letterGrade definition,
    2. deriveGrade(..) function prototype and
    3. convertToText() function prototype
  • Add the namespace gradeOpt to the grade.h header file and the namespace member function definitions to the file grade.cpp file.

Part B: (String)

Program Description:

Write a word search program that searches an input data file for a word specified by the user. The program should display the number of times the word appears in the input data file. In addition, the program should count and display the number of grammatical characters in the input data file. Your program must do this by providing the following functions :

void processFile(ifstream &inFile, string wordSearch, int &wordCount, int &grammaticalCount) ; (15%)

void displayResult(string word, int wordCount, int grammaticalCount)

Both functions should be called from main(). No non-constant global variables should be used.

Test your program using the file provided paragraph.dat.

Alfalfa Aloysius Alfred Francis Gerty Gramma Android Alexis Bumpkin Fred Rubble Betty Noshow Cecil Buff Bif Airpump Andrew Backus Carnivore Art Dandy Elephant Ima Franklin Benny George Boy Heffalump Harvey 123-45-6789 123-12-1234 567-89-0123 087-65-4321 456-78-9012 234-56-7890 345-67-8901 632-79-9939 223-45-6789 143-12-1234 565-89-0123 087-75-4321 456-71-9012 234-56-2890 345-67-3901 632-79-9439 90.0 97.9 80.0 23.0 78. 90.0 81.0 20.0 75.0 85.0 71.0 92.9 19.0 50.0 40.0 30.0 100.0 96.0 60.0 36.0 88.0 80.0 65.0 30.0 90.0 97.0 80.0 23.0 83.0 97.9 40.0 45.0 77.0 90.0 49.0 40.0 100.0 96.0 60. 36.0 88.0 80.0 91.0 20.0 49.0 48.0 44.0 47.0 45.0 46.0 43.0 50.0 83.0 97.0 40.0 45.0 77.0 90.9 84.0 30.0 18.0 90.0 11.0 91.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

What does the elimination process accomplish?

Answered: 1 week ago

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago