12/11/08

PRACTICE QUIZ


1. Write an m-file program that reads in quiz scores one at a time, calculates the average

score, and counts the number of quizzes that score i) less than or equal to 50, ii) over 50

and less than or equal to 75, and iii) over 75 and less than or equal to 100. Your program

should do the following:

a. Prompt the user “Enter quiz score or 999 to end”

b. Increment n_50, n_75, or n_100

c. Prompt the user again “Enter quiz score or 999 to end”

d. If the user enters 999 for the quiz score, the program should calculate the high

score, the low score, and the average score and print out:

Quiz average score = uu.uu

Highest score = hh

Lowest score = ll

Number of scores under 50 = xx

Number of scores between 50 and 75 = yy

Number of scores between 75 and 100=zz

and end. (“xx,” “yy,” and “zz” are the actual number of quizzes in each

category)

f. Have your program plot the score vs. the exam number (first exam: n=1, second

exam: n=2, etc.) as below.

Write out the program on the back of this sheet first. Then write the m-file in MATLAB, make

sure that it works, and then submit it to the Digital Dropbox on Blackboard as “Practice Quiz 1.”

Name your m-file “Practice_Quiz_xyz.m” where “xyz” are your initials.

No comments: