|
|
 |
|
|
|
|
Output: |
|
|
|
 |
|
|
|
|
First line-appropriate headings. |
|
|
|
 |
|
|
|
|
Next n records-transaction number, whether accepted or rejected; weight; and cost. |
|
|
|
 |
|
|
|
|
Last line-number of packages processed, number of packages rejected. |
|
|
|
|
|
|
|
|
7. The final exam in your psychology class consists of 30 multiple-choice questions. Your instructor says that if you write the program to grade the finals, you won't have to take the exam. |
|
|
|
 |
|
|
|
|
Input: |
|
|
|
 |
|
|
|
|
The first data line contains the key to the exam. The correct answers are the first 30 characters; they are followed by an integer number that says how many students took the exam (call it n). |
|
|
|
 |
|
|
|
|
The next n lines contain student answers in the first 30 character positions, followed by the student's name in the next 10 character positions. |
|
|
|
 |
|
|
|
|
Output: |
|
|
|
 |
|
|
|
|
For each student-the student's name; followed by the number of correct answers; followed by PASS if the number correct is 60 percent or better, or FAIL otherwise. |
|
|
|
|
|
|
|
|
1. For the Comparison of Two Lists case study, rewrite the program by eliminating the assumption that the two lists are of equal length. If one list is longer than the other, print a message indicating which is longer, and stop the comparison. |
|
|
|
|
|
|
|
|
2. In the Frequency of Certain Characters case study, the GetCharList function declares a formal parameter charList. Would it be all right to prefix the declaration of charList with the word const? Explain. |
|
|
|
|
|
|
|
|
3. Modify the CountAll program so that its output is the same as the CharCount program; that is, print the frequency of occurrence of a specified list of characters. |
|
|
|
|
|