Created
March 20, 2013 17:09
-
-
Save seyDoggy/5206431 to your computer and use it in GitHub Desktop.
Chapter 8 Assignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem Solving and Programming Concepts | |
Adam Merrifield (2697795). | |
Chapter 8 Assignment: pg 350 3a | |
3. a. Professor Zak allows students to drop the two lowest scores on the 10 | |
100-point quizzes she gives during the semester. Design an application that | |
accepts a student name and 10 quiz scores. Output the student’s name and | |
total points for the student’s eight highest-scoring quizzes. | |
start | |
Declarations | |
num SIZE = 9 | |
num score[SIZE] | |
num x | |
num y | |
num temp | |
num total | |
num QUIT = 999 | |
string name | |
string message | |
name = prompt("Please enter your name:") | |
score[] = getScores() | |
score[] = sortScores() | |
total = addScores(score) | |
outputData(name, total) | |
stop | |
getScores() | |
x = 1 | |
message = "Please enter score " x " of 10 (or " QUIT " to quit):" | |
while x < SIZE AND score[x - 1] != QUIT | |
score[x - 1] = prompt(message, x) | |
x++ | |
endwhile | |
return | |
sortScores() | |
x = 1 | |
while x < SIZE | |
temp = score[x] | |
y = x - 1 | |
while y >= 0 AND score[y] > temp | |
score[y + 1] = score[y] | |
y-- | |
endwhile | |
score[y + 1] = temp | |
x++ | |
endwhile | |
return | |
addScores(array score) | |
Definitions | |
num total = 0 | |
x = SIZE | |
while x > 1 | |
total = total + score[x] | |
x-- | |
endwhile | |
return | |
outputData(string name, num total) | |
output name "'s total score is:" | |
output total | |
return | |
string prompt(string msg) { | |
Definitions | |
string name | |
output msg | |
input name | |
return | |
num prompt(string msg, num X) { | |
Definitions | |
num score | |
output msg | |
input score | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
modify so that the student mean median score on the eighth best score are displayed ???