[Solved] CS201 Homework #5: Student Grade Ranking

$25

File Name: CS201__Homework__5__Student_Grade_Ranking.zip
File Size: 386.22 KB

SKU: [Solved] CS201 – Homework #5: Student Grade Ranking Category: Tag:
5/5 - (1 vote)

Processing

You can use a struct data structure to encapsulate data of one student, such as student name, points, etc. It is up to you to decide which fields are to be included in this struct.

You can use a vector to store several students data. Of course, the element type of this vector will be the previously defined student struct. Here please remark that you CANNOT make any assumption about the number of students in the course. The sample grades data file that we provided in the google drive folder is partially taken from the results of a course. You can observe from this sample that there are different numbers of students in each assessment list. Therefore, your program should work for any number of students. Moreover, your program should work for any student names which are consistent with the naming rules discussed in the Input File Section. In the sample, we used real student names from a previous class, but we can use other names for grading purposes.

The points table is a sorted list of students rankings. The order is determined by the total points that each student gained through all course assessments in a specific course. If there is a tie in points meaning there are two students with the same points, some other criteria will be used to determine the order. These details will be explained below.

Flow of the program may be as follows:

Your program should first ask for file name information from the user for the input files. Then, the user enters these file names from the keyboard. After that, your program opens the input files and tests for failure. If it fails to open any of these files, then the program will terminate with an appropriate message (see sample runs for the message).

If it opens all of the files successfully, then your program processes the input files. The processing method will be line by line since there is data for a specific student on each line for the input files of student information and grade results.

  • Regarding processing the input files, first, you need to calculate the total points that a student achieved at the end of the course by using ID information since there is no name information in the grade results file (i.e. also name information is not unique to search for a

student).

  • As mentioned in the Input File Section, there are grades for different assessments of a course in the input file of grade results. A particular assessment starts with ***Homework***, ***Midterm***, or ***Final*** tag. After one of these tags, we have the student ID number and his/her grade for the corresponding assessment (one student data per line). You need to differentiate these tags as you read them since each of them has a distinct weight and will contribute to the total points of a student at various levels. The total points of the student will be the weighted sum of the grades that s/he achieved for these specific evaluations (i.e. tags).
  • The processing for each student of the particular assessment section in the grade results file is as follows (note that this is just a suggested algorithm, and there could be other ways to solve this, so please feel free to create your own algorithm as well as using this one):
    • If this student is not in the vector (i.e. if this is his/her first appearance in the grade results file), then create a new student struct for this student and add to the vector. As you process the grade results file, you should retrieve the names of the corresponding student on that line from the students file by using the ID number (i.e. ID number exists in both of the input files).
    • If this student is already in your vector, update this existing student struct. That is, if this student has occurred before in the grade results file, then there should be a struct in the vector for him/her. If this is the case, you should only update the necessary information about the corresponding student without adding a struct for him/her to the vector again.
    • Updating the data of a specific student: Update the total point of a student by adding the weighted sum of the points gained from the particular assessment to his/her previous points. The weights for each evaluation scheme of a course are given below. The number of assignments (i.e. homework) and midterms will be more than one since the sum of the weight percentages should be equal to 100% (i.e. overall course grade will be computed from all of these particular assessments). You may assume the total percentage of these in the file will sum up to 100%, however do not make any assumptions of the number of each assessment. For example; there could be 3 homework assignments, 2 midterms and 1 final as given in the grades.txt file OR 1 homework, 3 midterms and 1 final OR 5 midterms and 0 homework and final as given in the grades2.txt file in the homework drive folder.
Particular Assessment WeightPercentage
Homework 10%
Midterm 20%
Final 30%

After your program finishes reading and processing all of the information in the input file of grade results and storing the necessary data in the vector, it should sort the vector in descending manner.

  • You may modify and use one of sorting algorithms provided by the book and/or discussed in the lecture. If you want to develop your own sorting algorithm, of course you may, but this will be more difficult.
  • You should sort the vector by points; students with higher points must be at higher positions in the table. If multiple students have the same point, then you should use the last name of the student; in this case the student with alphabetically smaller last name (in string comparison terms) must be at a higher position in the table. If multiple students have both the same point and last name, then they should be in any order in the table. You do not need to worry about it.

Finally you display the message Enter the rank you want to query (enter 0 to exit): that asks the user to enter the rank number to query for. You will display this query message until the user enters 0 to exit the program.

Output

After your program has the sorted point table and the user enters a rank integer, the student information with the given rank is displayed on the screen. Four pieces of information must be displayed for the student queried; these are Rank of the student in the points table, ID number of the student, Name of the student (i.e. first name, middle name if exists and last name), Points that the student gained. These four pieces of information must be displayed in this order and there must be commas in between.

For the name of the student in the output, please use the following formats for the possible two cases (NO ADDITIONAL SPACES!):

  1. FirstName-SingleSpace-MiddleName-SingleSpace-LastName (middle name exists) Example: Ali(space)Can(space)Akdeniz
  2. FirstName-SingleSpace-LastName (there is no middle name)

Example: Gizem(space)(space)Gezici (wrong), it should be

Gizem(space)Gezici (right)

In the google drive folder of this homework, we provide sample input files (students.txt, grades.txt with an example ranking table file also (results.txt). You may examine and of course use them to understand the homework and output format in detail.

Please see the sample runs for examples using these given input files.

Sample Runs

Below, we provide a sample run of the program that you will develop. The italic and bold phrases are inputs taken from the user. You should follow the input order in these examples and the prompts your program will display must be exactly the same as in the following examples.

Sample Run 1

Please enter a filename for Students Grades Results: grades Can not find the requested file. Terminating application

Sample Run 2

Please enter a filename for Students Grades Results: grades.txt Please enter a filename for Students Names : nothere.txt Can not find the requested file. Terminating application

Sample Run 3

Please enter a filename for Students Grades Results: grades.txt

Please enter a filename for Students Names : students.txt

Enter the rank you want to query (enter 0 to exit): 1

1, 00012287, Onur Akdeniz, 81.2

Enter the rank you want to query (enter 0 to exit): 4

4, 00011464, Alper Aydin, 74.7

Enter the rank you want to query (enter 0 to exit): 4

4, 00011464, Alper Aydin, 74.7

Enter the rank you want to query (enter 0 to exit): 19 Rank needs to be greater than 0 and smaller than 16!

Enter the rank you want to query (enter 0 to exit): 11

11, 00010926, Ekrem Sinan Aygun, 60.5

Enter the rank you want to query (enter 0 to exit): 7

7, 00011530, Burcu Aciksoz, 66.2

Enter the rank you want to query (enter 0 to exit): 8

8, 00010206, Gizem Gezici, 66.2

Enter the rank you want to query (enter 0 to exit): 14

14, 00011412, Yonca Betul Karadeniz, 57.5

Enter the rank you want to query (enter 0 to exit): 2

2, 00009029, Ali Can Akdeniz, 74.9

Enter the rank you want to query (enter 0 to exit): 15

15, 00008963, Selcuk Akaydin, 50.8

Enter the rank you want to query (enter 0 to exit): -5 Rank needs to be greater than 0 and smaller than 16! Enter the rank you want to query (enter 0 to exit): 314323 Rank needs to be greater than 0 and smaller than 16!

Enter the rank you want to query (enter 0 to exit): 5

5, 00009713, Ozge Karadeniz, 68.9

Enter the rank you want to query (enter 0 to exit): 0 Exiting

Sample Run 4

Please enter a filename for Students Grades Results: grades2.txt

Please enter a filename for Students Names : students.txt Enter the rank you want to query (enter 0 to exit): 15 Rank needs to be greater than 0 and smaller than 14!

Enter the rank you want to query (enter 0 to exit): 13

13, 00011366, Yigit Akar, 54.6

Enter the rank you want to query (enter 0 to exit): 1

1, 00012287, Onur Akdeniz, 83

Enter the rank you want to query (enter 0 to exit): 5

5, 00009713, Ozge Karadeniz, 72.4

Enter the rank you want to query (enter 0 to exit): 0 Exiting

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS201  Homework #5: Student Grade Ranking[Solved] CS201 Homework #5: Student Grade Ranking
$25