CS 1160留学生讲解、辅导Programming、讲解C/C++编程语言、辅导C/C++

- 首页 >> 其他
CS 1160 C/C++ Programming
C/C++ Programming Homework #6
Grade Book Program
You are required to complete an interactive grade-book program.
To be useful, the scores for a class is stored in a text file, where the first two values in the files
are the number of students and number of scores for each student. Next are the column label for
each score (e.g. “HW 1”, “HW 2”, “Lab 1”, “Test 1”). After column labels, each student has a
pair of lines consisting of a line with their name, and a line with their scores separated by space.
One example of the file is shown in the following:
gradebook.txt
The information of the grade book file can be visualized in the parallel arrays as (assume the
maximum number of students is 100 and the maximum number of columns is 50):
The program should be able to read the score from the txt file and store the scores in a 2D array.
The student names will be stored in a parallel array. Column titles will be stored in another
parallel array. The program can display and update the scores, and save the scores back to a txt
file if requested by the user.
0 1 2 3 4 5 … 49
Column
Titles:
HW 1 HW 2 Lab 1 Lab 2 Test 1
CS 1160 C/C++ Programming Instructor: Dr. Jin Zhu
The program interactive interface is shown as below:
Part of the functions has been implemented in the attached program gradeBook.cpp. You can
find the sample gradebook.txt file in the attachment too. Current program is able to display
scores. You need to add code to complete menu options:
 (A)dd column of scores - add a new column title and scores on the right side of the table
 (N)ew student - add a new student name at the bottom of the table and prompt for their
scores using column-headings
 (C)hange a score - change a single score by prompting for a student’s name and a
column-heading
 You also need to complete the function so that it is able to calculate and display average
score for each student.
Please make sure you think about logic carefully that you need to implement before you start
coding. You may use flowchart to clarify the logic and define functions using English first.
Note:
When you write your program, be sure you:
 use meaningful variable names with good style (i.e., useCamelCase)
 use comments (// single-line or /* Multi-line Comment */) at the start of the program, to
label tricky blocks of code, and to explain the contents of variables
 use global constants where appropriate with good style
ALL_CAPS_AND_UNDERSCORES (Put your global constants after your #include
compiler-directives and before your main function definition so they can be found and
changed easily in future versions of your program.)
 format the user interaction nicely. Provide clear instructions to the user.
 Please use “functions” to implement the required functions.
Enter file name: gradebook.txt
There are 3 students with 5 score columns.
Student Names HW 1 HW 2 Lab 1 Lab 2 Test 1
Doe, Jane : 1 2 3 4 5 Average Score = 3.0
Morse, Cody : 1.1 2.3 3.3 3.4 4.5 Average Score = 2.9
Smith, John : 2.0 2.0 3.0 4.0 10.0 Average Score = 4.2
Column Averages 1.4 2.1 3.1 3.8 6.5
Grade Book Menu
(D)isplay all scores
(A)dd one column of scores
(N)ew student
(C)hange a score
(E)xit program
Enter your choice:
CS 1160 C/C++ Programming Instructor: Dr. Jin Zhu
Submission requirements:
Submit the following files in the e-Learning homework assignment link by the given deadline
(No late program submission will be accepted):
1. source file gradeBookFinal.cpp (your C++ source code)
2. Outputs from your program running including the following actions:
a) Add column of scores;
b) Add new student;
c) Change a score;
d) Save the updated score into a txt file.
3. The saved txt file.