联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-12-03 09:29

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.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp