The assignment is: Write an algoright(a step-by-step set of instructions) for the following problem: [you must approach this problem as if you were explaining the procedure to a machine]
You are to calculate the average test score for a student. The student has taken 10 test. There should be a loop to input the test scores. You do not need to store the scores in a list, but you can do so if you want. Otherwise, just add them up as you input them. Calculate and output the average. If the average is less than 60.0, print out the message, "You need to get extra help".
This is what I've done so far:
Output “Do you wish to do another calculation?”
Input response
Repeat until response equals n
{
Output “Please enter the scores”
Input L[i]
Set i to 0
Repeat until i equals 9
{
Calculate (L[0]+L[1]+L[2]+L[3]+L[4]+L[5]+L[6]+L[7]+L[8]+L[9])/10
Set i to i+1
}
If score<60.0
Output “You need to get extra help”
Otherwise
Do nothing.
Output “Do you wish to do another calculation?”
Input response
}
Output “Done”
Writing an Algorithm (not a programming problem)
Page 1 of 14 Replies - 1386 Views - Last Post: 13 September 2012 - 02:19 PM
#1
Writing an Algorithm (not a programming problem)
Posted 13 September 2012 - 01:26 PM
Replies To: Writing an Algorithm (not a programming problem)
#2
Re: Writing an Algorithm (not a programming problem)
Posted 13 September 2012 - 01:28 PM
Are you asking for feedback, or do you have a specific problem you'd like advice with?
#3
Re: Writing an Algorithm (not a programming problem)
Posted 13 September 2012 - 01:39 PM
I'm looking for feedback, corrections on my work so that it is going to work when I hand it in
I'm pretty sure that is not completely correct
I'm pretty sure that is not completely correct
#4
Re: Writing an Algorithm (not a programming problem)
Posted 13 September 2012 - 01:45 PM
Quote
Set i to 0
Repeat until i equals 9
{
Calculate (L[0]+L[1]+L[2]+L[3]+L[4]+L[5]+L[6]+L[7]+L[8]+L[9])/10
Set i to i+1
}
If score<60.0
Repeat until i equals 9
{
Calculate (L[0]+L[1]+L[2]+L[3]+L[4]+L[5]+L[6]+L[7]+L[8]+L[9])/10
Set i to i+1
}
If score<60.0
This does not make much sense. You calculate the average 10 times. You seem to understand that you need to loop. It needs to look like the following.
Set sum to 0
Set i to 0
Repeat until i equals 9
{
/*Fill in the missing instruction*/
Set i to i+1
}
set score to /*calculated average based on loop results*/
If score<60.0
#5
Re: Writing an Algorithm (not a programming problem)
Posted 13 September 2012 - 02:19 PM
An algorithm is steps you need to follow to accomplish a task.
Eg;- Cup of Tea making algorithm.
Potwashing Alogrithm
Calculating an Average Algorithm
It should be a series of written English (preferable) statements. ** NOT CODE **
Eg;- Cup of Tea making algorithm.
Potwashing Alogrithm
Calculating an Average Algorithm
It should be a series of written English (preferable) statements. ** NOT CODE **
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote







|