Project1

advertisement
CSIS 10A
Project 1: Student Grading Program
25 Points
DUE:
This project will guide you in the development of a relatively complex programming problem that will
use the C++ skills you have been practicing in the assignments.
Grading:
Test Plan
Problem Solution Step
Problem Solution Step
Problem Solution Step
Problem Solution Step
Problem Solution Step
2
3
4
5
6
5 Points
4 Points
4 Points
4 Points
4 Points
4 Points
The Problem Statement
In this project you will write an interactive program to grade a class of students. Use a data sentinel loop
similar to that of receipt.cpp (ch07 folder) to input and process each student’s name and three exam
scores. The program will find each student’s average and determine whether the student passed (at least
60 percent) or failed. The first part of the text file output will be a table of labeled, properly aligned
columns giving each student’s name, three grades, average (accurate to the nearest tenth), and a message
(passed or failed). The second part of the output will give the class size, the number of students who
passed, and the name and average of the student with the highest average.
1. Test Plan
The following test plan shows what the interactive session of your program will look like. User input is
in boldface.
Enter student name or xyz to stop:
Enter three exam grades: 59 78 84
Enter student name or xyz to stop:
Enter three exam grades: 55 60 57
Enter student name or xyz to stop:
Enter three exam grades: 93 45 77
Enter student name or xyz to stop:
Enter three exam grades: 75 85 80
Enter student name or xyz to stop:
Enter three exam grades: 99 89 94
Enter student name or xyz to stop:
Please open file grades.txt to see
Win Hansen
Alan Turing
Sal Ruida
Akila Pratt
Marie Curie
xyz
results
To make sure you understand the problem statement, fill in the following table showing what the
contents of your output file grades.txt should look like after the program finishes, according to the
Problem Statement above.
1
Contents of file grades.txt
2. Developing a Solution
In designing a solution to any programming problem there are two general approaches you may decide to
take. The first is the Bottom Up approach, and the second is the Top Down approach. Both of these
approaches may involve the use of pseudocode, or using english like statements to express the meaning
of our code rather than the detailed C++ syntax which can hamper our thinking. Many beginners prefer
bottom up because they can manage the increasing complexity in small steps through successive versions
of their programs. In this project we are more or less using the bottom up approach.
In the bottom up approach we solve the simplest possible variation of the problem, then add more
complex details later. Using the bottom up approach, we might work in the following manner:
Problem Solution Steps
1) Start from scratch (but use the code expressed in receipt.cpp) and make a program that reads
names and writes them to a file, stopping when a name of ‘xyz’ is entered.
2) Add the ability to read 3 grades for each name, and add the grades to the output file.
3) Add code to calculate the average of each student’s grades and write the average to the file.
4) Add code to keep track of the total number of students processed (add to output file)
5) Add code to keep track of the number of passing students
6) Add code to keep track of the highest scoring student and add this information to the output file.
You can solve the problem in any manner you like, but it is recommended that you use the step
solution outlined above.
Notice how we have deliberately broken the solution development into 6 distinct steps. This allows us to
create 6 versions of the program as we build the final solution. When you solve part1, save the file as
part2, part3, etc and continue developing the next step. If you get stuck, you can return to an earlier step
and continue on.
Note on Academic Honesty Working with others on assignments is a good way to learn the material
and is encouraged. However, there are limits to the degree of cooperation that is allowed in this class.
When working on programming assignments, you must work only with others whose understanding of
the material is approximately equal to yours. Anything that you hand in, whether it is a written problem
or a computer program, must be written in your own words. If you base your solution on any other
written solution, you are cheating.
2
Violators of this rule will be given zero points for the assignment or project involved. If you have any
questions about what constitutes cheating, please ask.
3
Related documents
Download