Homework 7 UCR CS10: Introduction to Computer Science Winter Quarter 2004, Lecturer: Kris Miller Due Wednesday, February 25 before 8:00pm by web turnin. YOU MUST TURN THIS IN AS A .CPP, .CC, OR .C FILE. The turnin system will no longer accept other types of files. Your file names should not have spaces or non-alphanumeric characters. A good file name to use is hw7.cpp. ------------------------------------------------------------------------------- Note: Collaboration policy for this homework assignment Collaboration on this homework is strongly ENCOURAGED. The homework is intended for practice, not assessment -- most people who turn in decent work should get most if not all points for this assignment. Forming study groups is strongly encouraged. You shouldn't simply copy answers from any source -- each other, the book, the web, other books, previous solutions, etc. But you can certainly discuss how to solve the problems, look over each others solutions and help "debug" them, compare answers and redo problems if you determine your answer is wrong, and most importantly, explain concepts related to the problems and solutions. ------------------------------------------------------------------------------- 1. Self-test Exercise #5-14 (Chapter 5, #14) 2. Self-test Exercise #5-22 3. Self-test Exercise #5-29 4. Self-test Exercise #5-30 5. Self-test Exercise #6-1 6. Self-test Exercise #6-2 7. Self-test Exercise #6-6 8. Self-test Exercise #6-7 9. Self-test Exercise #6-8 Solutions for Self-test Exercises are in the back of each chapter. 10. Programming Project #1 - Chapter 6 (CodeMate) The following is the code that you would put between the lines in CodeMate ENTER YOUR CODE HERE END USER CODE struct StudentRecord { double quiz1; double quiz2; double midtermExam; double finalExam; double courseAverage; char letterGrade; }; void getScores (StudentRecord& record); //preconditions: StudentRecord object has been declared. //postconditions: Quiz 1, Quiz 2, Midterm, and Final scores have been supplied // user. void outputRecord (StudentRecord record); //preconditions: All scores have values and courseAverage and letterGrade have // been calculated. //postconditions: All scores, courseAverage and letterGrade have been output to // the screen. void computeAverage (StudentRecord& record); //preconditions: quiz1, quiz 2, midtermExam, and finalExam member variables have // been given values. //postconditions: courseAverage and letterGrade have been calculated and these // member variables have been updated. // Calls letterGrade function to calculate letterGrade. char letterGrade (double numericGrade); //preconditions: Parameter numericGrade has been given a value between 0 - 100 // that is graded on a 90/80/70/60 letter grade scale. //postconditions: Returns the letter grade according to the 90/80/70/60 scale. int main() { StudentRecord student; getScores(student); computeAverage(student); outputRecord(student); return 0; } void getScores (StudentRecord& record) { cout << "Enter student's grade for quiz 1:"; cin >> record.quiz1; cout << "\n\nEnter student's grade for quiz 2:"; cin >> record.quiz2; cout << "\n\nEnter student's grade for the midterm:"; cin >> record.midtermExam; cout << "\n\nEnter student's grade for the final:"; cin >> record.finalExam; }