Need programming help with a file that contains students’ ID

User Generated

Cebsrffbe Wraavsre

Programming

Description

You are given a file called “students.txt” that contains students’ ID and marks as follows:

200121101 9 19 29 29

200121102 5 10 14 30

200121103 6 15 20 20

200121104 10 17 25 35

200121105 10 18 26 37

200121106 8 14 23 32

200121107 10 20 30 40

200121108 10 19 25 30

200121109 6 8 6 17

200121110 5 15 20 30

200121111 9 9 20 29

200121112 10 10 29 9

Each line consists of a student’s ID, first_mark, midterm_mark, lab_mark and final_mark. The number of students is not specified in advance.

Write a program that calls the following methods:

  1. ReadData that reads data from “students.txt”. It should take as parameters an array of String studentID and a two-dimensional array of int marks. It stores the students’ ID in the array studentID and the students’ marks in the array marks. This method returns the number of students found in the file.
  2. CalculateTotalMarks that takes as parameters the two-dimensional array of int marks, an array of int total and the number of students. It should calculate the total mark for each student and store it in total.
  3. FindGrades that takes as parameters the array of int total, an array of char grades and the number of students. It should find the appropriate character grade for each student and store it in grades.
  4. calculateAverage that takes as parameters the array of int total and the number of students. It should calculate and return the average class mark.
  5. FindMax that takes as parameters the array of int total and the number of students. It should find and return the class highest mark.
  6. FindMin that takes as parameters the array of int total and the number of students. It should find and return the class lowest mark.
  7. PrintResults that takes as parameters the array of String studentID, the array of int total, the array of char grades, and the number of students. It should output in the file ‘Results.txt” the following data:

a)  The Student’s ID, total mark, and grade for all students who passed the course.

b)  The Student’s ID, total mark, and grade for all students who failed the course.

c)  The total number of students.

d)  The average class mark.

e)  The highest mark.

f)  The lowest mark.

Sample output data are shown below:

Students who passed are:

200121101  86  B

200121103  61  D

200121104  87  B

200121105  91  A

200121106  77  C

200121107  100  A

200121108  84  B

200121110  70  C

200121111  67  D

Students who failed are:

200121102  59  F

200121109  37  F

200121112  58  F

The total number of students:  12

The average total mark:  73.08333333333333

The highest mark:  100

The lowest mark:  37


User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer


Anonymous
Just the thing I needed, saved me a lot of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags