1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Very Basic Programming Homework

  1. Oct 19, 2009 #1
    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.
     
  2. jcsd
  3. Oct 19, 2009 #2

    DaveC426913

    User Avatar
    Gold Member

    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.
     
  4. Oct 19, 2009 #3
    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?
     
  5. Oct 19, 2009 #4

    DaveC426913

    User Avatar
    Gold Member

    Well, 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.

    Correct. You still have step 2 to do.

    Your flowcharting program will probably have an option to export to GIF or BMP.
     
    Last edited: Oct 20, 2009
  6. Oct 20, 2009 #5
    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.
     

    Attached Files:

  7. Oct 20, 2009 #6

    DaveC426913

    User Avatar
    Gold Member

    Attachments are still pending approval.

    Have you studied my suggestions and made any progress?
     
  8. Oct 20, 2009 #7

    berkeman

    User Avatar

    Staff: Mentor

    Please avoid posting in DOC format -- there are issues with macros and such. PDF format is preferred. Thanks.
     
  9. Oct 20, 2009 #8

    DaveC426913

    User Avatar
    Gold Member

    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.
     
  10. Feb 26, 2011 #9
    Hold on.
    Is there any relevance of BASIC programming to physics.
     
  11. Feb 28, 2011 #10
    This thread is over a year old and the OP hasn't been back here since then.

    Programming can be very relevant to physics, just as with most other fields such as engineering. Not sure about basic though.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Very Basic Programming Homework
Loading...