Copy project files in grade_file_homework_stub (https://github.com/LoyolaChicagoBooks/introcscsharp-examples/blob/master/grade_file_homework_stub) to your own project. Then you should have copies of the source file grade_files.cs (https://github.com/LoyolaChicagoBooks/introcs-csharpexamples/blob/master/grade_file_homework_stub/grade_files.cs) for you to c o m p l e t e for this homework. The folder also contains sample data files including the examples discussed below.

In this assignment, were going to begin taking steps to help you achieve greater i n d e p e n d e n c e when it comes to programming. This means (among other things) that you will be given what is commonly known as a specification. In software developmentand in the business world in general, it is customary to capture a set of b u s i n e s s r e q u i r e m e n t s in what is commonly known as a r e q u i r e m e n t s s p e c i f i c a t i o n document. While what you read here will be much more concise, we want you to become familiar with requirements-driven thinking, without which many real-world software projects fail.

After presenting the set of requirements, we will give you some hints for how to i m p l e m e n t the requirements. These hints may or may not prove completely helpful to you, and you are also invited to come up with your own solutions. As we inch closer to the semester project, youre going to want to use your imagination to create a good solution to a problem.

Brief Problem Statement

The previous two homework assignments represent a great simplification of the real-world process of grading. The notion that grade information must be entered manually is rather tedious, not to mention error prone. In the real world, grade information would be kept in a file (a spreadsheet is common), from which various calculations and summary reports could be generated.

In this assignment, the problem we are trying to solve is to take all of the r a w grade data from one or more student files and prepare a s u m m a r y r e p o r t file with a line for each student.

Although we could do all of what were describing here with a s p r e a d s h e e t , the point is to show how we can use C# to read in a simplified form of comma-separated data, process it, and do some generalpurpose calculations on the data.

Using C#

Well be making use of a number of C# features (some old, some new) in this homework:

  • decisions, loops, strings, and functions
  • files
  • arrays

Requirements

1. Unlike in previous assignments, this program must accept data from a collection of input files (that is, it will not be reading most of the data from the class Console ).

2. The program needs a course abbreviation from the user. If there is a command line argument, use it as the course abbreviation. Make sure your code can read a command-line argument using the special form of Main(string[]args) already in the stub grade_files.cs (https://github.com/LoyolaChicagoBooks/introcs-csharpexamples/blob/master/grade_file_homework_stub/grade_files.cs). If the user does not provide at command line argument, prompt the user for it once the program starts. An example would be comp170. All data files will include the course abbreviation as part of their name. We will use comp170 in the examples below, but it could be something else. The folder also contains sample data files for a course abbreviation comp150.

Note that these data files are not in the Xamarin Studio execution directory, but in the project directory, so the F I O H e l p e r C l a s s (fio.html#fio) is useful to provide flexibility in reading the data files.

3. There are two master files for any course. One is categories_ + the course abbreviation + .txt. For example, categories_comp170.txt is a sample data file provided and used below.

It will contain three lines. The first line is a comma separated list of category names like

Exam,Lab,Homework,Project,ClassParticipation

There may be extra spaces after the commas. Categories will be chosen so that e a c h o n e s t a r t s w i t h a d i f f e r e n t l e t t e r .

The second line contains the integer weights for each category, like

40,15,15,20,10

They do n o t need to add to 100. If the sum is called totWeights, get the final grade by summing for each category:

(categoryweight)(categorygrade)/totWeights

The third line will contain the number of grades in each category, like

2,5,3,1,2

The second master file will be students_ + the course abbreviation + .txt. For example students_comp170.txt . It will contain a list of student information records. Each record (one per input line) will have the following structure:

Student ID, Last Name, First Name

For example, the sample data file students_comp170.txt starts:

P12345678, Doe, John
P00000001, Hernandez, Maria

4. There will be a secondary file for each student, named after the student id and the course abbreviation and .data. For example, Johns scores would be kept in a file named P12345678comp170.data . Marias scores would be in P00000001comp170.data . Each record (one per file line will have the following structure:

Category letter, Item, Points Earned

where:

  • category letter is the first letter of the category. With the categories given in the example above, they would be E, L, H, P, and C.
  • item is a number within that category (1, 2, 3, ...) - only used in part of the extra credit.
  • points earned is a real number
  • the lines are in no special order.

Sample data file P12345678comp170.data starts:

H, 1, 90
C, 1, 100
L, 3, 100
L, 2, 80
H, 2, 80
E, 1, 90

5. The program will process the data from each student file and calculate the average within each category, and then the weighted overall average. Also display the letter grade for each student, using code derived from the previous assignment.

6. Your program writes the final report file. It is named with the course abbreviation + _summary.txt. Example: comp170_summary.txt. This file must have a line for each student showing the students last name, first name, weighted average rounded to one decimal place, and letter grade. File comp170_summary.txt would start with lines:

Doe, John 78.9 C+
Hernandez, Maria 88.2 B+

Write this file to the same directory where you found the input data. Again the F I O H e l p e r C l a s s (fio.html#fio) is useful.

7. The rest of the test data for course abbreviations comp170 and all the data for comp150 is in the homework directory. There are also sample solution files for the summaries (including some extra credit additions at the ends of lines). Their names end in _solution.txt to distinguish them from the summary files you should generate this tests.

While your program should certainly work for course abbreviations comp170 and comp150, it should also work in general for any data files your refer to in the defined formats and place in the same folder.

8. Turn in materials as in the last homework, including a single copy of the homework source files and a log.txt file for each student, in the same form as for the last homework.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.