CS 1401, Quiz #5, version a

Date: Tuesday, October 4, 2005
Name (please type legibly, ideally in block letters): ______________________________________________________________________

1. To discourage speeding, one county decided to fine $25 for going up to 10 miles per hour above the speed limit, $50 for up to 20 miles per hour above the speed limit, and $200 after that. Assuming that we are given the variables actualSpeed and speedLimit, write down a piece of code that assigns the corresponding value to the variable fine. Do not forget that if there is no speeding, fine is 0.














2. A school district has to pass at least 70% of the students in both standard tests - in English and in Math. Thus, a district is considered failing if it either passes less than 70% in English, or less than 70% in Math. Write down a piece of code that, given the percentages passEnglish and passMath, assigns the corresponding value to the Boolean variable failing.










3. So far, we used objects of the class BufferedReader for the computer to read what we type on the keyboard. How else are objects the class BufferedReader used in Java? Hint: it has something to do with files.