Project1.doc

advertisement
CSIS 10A
Project 1: Student Grading Program
25 Points
DUE:
(You may also do Problem 21 on Page 175 instead)
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
5 Points
5 Points
5 Points
3 Points
2 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 letter
grade (A through F). 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 test 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:
Please open file grades.txt to see
Win Hansen
Alan Turing
Sal Ruida
Akila Pratt
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 code to read 3 exam scores for each name, and send the scores to the output file.
3) Copy your avg3( ) and grade( ) functions from Lab4Problem7and8.cpp into your program file.
Use avg3( ) to calculate the average of the three test scores and grade( ) to convert that average
to a letter grade. Send the average and letter grade to the output 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 (who average 60 or higher).
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, and continue developing the next step, and so on. 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.
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.
Violators of this rule (those who copy and those who let their work be copied) will be given zero points
for the assignment or project involved. If you have any questions, please ask.
2
Related documents
Download