19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

210 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

FIGURE 6-13 Possible Outcome of Project 1<br />

2. Statisticians use the concepts of mean <strong>and</strong> st<strong>and</strong>ard deviation to describe a<br />

collection of data. The mean is the average value of the items, <strong>and</strong> the st<strong>and</strong>ard<br />

deviation measures the spread or dispersal of the numbers about the mean. Formally,<br />

if x1, x2, x3, . . . , xn is a collection of data, then<br />

mean = m =<br />

(x1 st<strong>and</strong>ard deviation = s =<br />

– m)<br />

Write a computer program to<br />

(a) Place the exam scores 59, 60, 65, 75, 56, 90, 66, 62, 98, 72, 95, 71, 63, 77,<br />

65, 77, 65, 50, 85, <strong>and</strong> 62 into an array.<br />

(b) Calculate the mean <strong>and</strong> st<strong>and</strong>ard deviation of the exam scores.<br />

(c) Assign letter grades to each exam score, ES, as follows:<br />

ES ≥ m + 1.5s A<br />

m + .5s ≤ ES < m + 1.5s B<br />

m – .5s ≤ ES < m + .5s C<br />

m – 1.5s ≤ ES < m – .5s D<br />

ES < m – 1.5s F<br />

For instance, if m were 70 <strong>and</strong> s were 12, then grades of 88 or above would<br />

receive A’s, grades between 76 <strong>and</strong> 87 would receive B’s, <strong>and</strong> so on. A<br />

process of this type is referred to as curving grades.<br />

(d) Display a list of the exam scores along with their corresponding grades as<br />

shown in Figure 6-14.<br />

2 + (x2 – m) 2 + (x3 – m) 2 + . . . + (xn – m) 2<br />

������<br />

n – 1<br />

FIGURE 6-14 Output of Project 2<br />

x1 + x2 + x3 + . . . + xn<br />

���<br />

n<br />

����

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!