Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a c++ programming problem, plz helpall the information that professor gave are here. The assignment You are to implement a library file (.h)

This is a c++ programming problem, plz helpall the information that professor gave are here.

The assignment

You are to implement a library file (.h) containing the function compute_overall_score. This function should receive two string variables as parameters. The first parameter correspond to the name of a text file that contains the grades earned by a student throughout the quarter. On the other hand, the second parameter contains the name of a log file where information will be sent.

This is (in principle) a very simple assignment. Since the idea behind it is to make sure you review some (or most) of the concepts from 10A. You need to make sure your project follows the rules below:

Your project should use a three-file layout: simple driver (e.g. hw1-driver.cpp) + user-defined library (hw1.h) + implementation of the functions defined in the library (hw1.cpp).

You need to use AT LEAST ONE class. This is entirely up to you. It could be a very simple class with no member functions, or a more complex setup with several different classes.

You need to pass AT LEAST ONE PARAMETER by reference to a function.

You need to use AT LEAST ONE POINTER (do not worry if you did not cover this topic in 10A, I will briefly mention during class the easiest way to fulfill this requirement).

You need to use AT LEAST ONE VECTOR OR ARRAY (the choice is up to you).

When your project is run, the overall grade should be displayed to the console as well as being sent to the log file specified in the driver. Said overall score should be reported as a percentage with two decimals (e.g: 74.47%). You may also report the scores corresponding to the two different grading breakdowns.

For this project you may assume that:

the user will supply a valid file containing the scores of a student and that this file will be correctly formatted. The first line will contain 8 integers between 0 and 20, separated by a blank space; the second line will contain 2 integers between 0 and 100 separated by a tab character '\t' ; and the third line will contain 1 integer between 0 and 100.

For testing purposes you may use the file xibalba.txt;or you can create your own, as long as it adheres to the guidelines given above.

When my implementation is run with the data inside the xibalba.txt file, the output it produces looks more or less like this:

Score A: 89.0786 Score B: 88.9986 Overall score: 89.08%

What is this assignment about?

Review. Plain and simple review. Some of you took PIC 10A this past quarter and are very familiar with these topics, whereas some of you took it a while back and need to review some concepts. In any case it is always a good idea to make sure we review these basic concepts.

A technical note

Unfortunately, different operating systems (e.g: windows, Mac OS) treat text files in slightly different ways. If for some reason the test file described above appears to consist of just one line with 11 integers, try to copy/paste the information into a file named xibalba.txt created using your own computer.

hw1-driver.cpp

#include "hw1.h" #include int main(){ compute_overall_score("xibalba.txt", "xibalba_overall.txt"); compute_overall_score("file1.txt", "grade1.txt"); return 0; } 

hw1.h

// W A R N I N G ! ! ! // You should ALWAYS comment your code. Points will // be deducted if you do not remove this warning. #ifndef HW1_H #define HW1_H #include // Other libraries you need should be placed here: /** Forward declaration of auxiliary functions. At the very least, you should implement a function with the signature: void compute_overall_score(std::string, std::string); */ // Other functions you need should be placed here: /** The declaration of user defined classes should be placed here. E.G. class MyClass{ public: // Constructor(s) // Other member functions private: // Member fields }; */ #endif 

hw1.cpp

// WARNING: See hw1.h #include "hw1.h" //Other libraries you might need should be placed here: /** Function that you are required to implement (stub). */ void compute_overall_score(std::string inputFile, std::string outputFile){ return; } /** The implementation of other functions/classes should be placed below */ 

xibalba.txt

16 14 20 17 16 18 20 20 86 92 88 

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Explain the causes of indiscipline.

Answered: 1 week ago