PDA

View Full Version : Very Basic Programming Homework


ksweeper21
Oct20-09, 12:05 AM
I am taking a very basic programming class, and all we work with is fliowcharts and pseudocode. We use the following book: Programming Logic and Design, 5th edition, comprehensive by Joyce Farrell. We use VISIO for the flowcharts, and Word for the pseudocode. And I need help with the following question:

5a. Watson Elementary School contains 30 classrooms numbered 1 through 30. Each classroom can contain any number of students up to 35. Each student takes an achievement test at the end of the school year and receives a score from 0 through 100. Write a program that accepts data for each student in the school---student ID, classroom number, and score on the acievement test.

Design a program that lists the total points scored for each of the 30 classrooms.

I have completed the flowchart for this part, but I got confused when trying to finish the pseudocode. Here is my pseudocode for part 5a.

It won't let me upload the files here, so I will post my pseudocode for part 5a (what I have of it) and if you need to see the flowchart, email me at the email address below, or tell me how to attach it!

Start
num stuID
num classNum
num score
num SIZE = 30
num totalPnts[SIZE] = 0
get stuID, classNum, score
while not eof
if classNum >= 1 AND classNum <= SIZE then
totalPnts[classNum – 1] = totalPnts[classNum – 1] + score
else
print “invalid classroom number”
endif
get stuID, classNum, score (GOT LOST RIGHT HERE)



classNum = classNum + 1
endwhile
Stop

The gap between get stuID, classNum, score and classNum = classNum + 1 is where the rest of the pseudocode goes, but I got lost.

5b. Modify Exercise 5a to that each classroom's average of the test scores prints, rather than each classroom's total.

I need both flowchart and pseudocode for this part.

Any help will be greatly appreciated. Please email me at ksweeper21@gmail.com. Thank you.

DaveC426913
Oct20-09, 12:36 AM
Your program will have TWO steps. Step one will collate all the data by iterating through the student data.

ONCE THAT IS DONE, step 2 will iterate through the classroom array and print them out.

You have completed step 1 - there is no missing code. But there is one change required: drop the classNum = classNum + 1. You will not iterate through the classes in the first step, only in the second.

ksweeper21
Oct20-09, 12:40 AM
When my instructor went over the problem, that part of the pseudocode was included, and other people in the class said I was missing the end of the pseudocode.

I would like to post my flowchart for part 5a, but the file type is not allowed. Any suggestions?

DaveC426913
Oct20-09, 12:44 AM
When my instructor went over the problem, that part of the pseudocode was includedWell, there are many ways of solving a given problem. I don't know what his way is. It is true, your program will end with that line, but it is currently in the wrong place.

and other people in the class said I was missing the end of the pseudocode.
Correct. You still have step 2 to do.

I would like to post my flowchart for part 5a, but the file type is not allowed. Any suggestions?Your flowcharting program will probably have an option to export to GIF or BMP.

ksweeper21
Oct20-09, 01:43 PM
Alright, Here is my flowchart for part 5a. and the pseudocode for part 5a again, just in case.


I really need help with at least the flowchart or pseudocode for part 5b.


Thank you very much.

DaveC426913
Oct20-09, 04:19 PM
Alright, Here is my flowchart for part 5a. and the pseudocode for part 5a again, just in case.


I really need help with at least the flowchart or pseudocode for part 5b.


Thank you very much.

Attachments are still pending approval.

Have you studied my suggestions and made any progress?

berkeman
Oct20-09, 08:08 PM
Alright, Here is my flowchart for part 5a. and the pseudocode for part 5a again, just in case.


I really need help with at least the flowchart or pseudocode for part 5b.


Thank you very much.

Please avoid posting in DOC format -- there are issues with macros and such. PDF format is preferred. Thanks.

DaveC426913
Oct20-09, 11:13 PM
Alright, Here is my flowchart for part 5a. and the pseudocode for part 5a again, just in case.


I really need help with at least the flowchart or pseudocode for part 5b.


Thank you very much.
OK. The flowchart is incomplete.

As I said previously:
1] So far you've only done step 1 - data collation. You haven't done step 2 - output.
2] The classnum = classnum + 1 is out of place. It has no place in step 1 but will be needed in step 2.