locked
Intro to Programming Small Basic Lab RRS feed

  • Question

  • Hello All,

    I am currently working on a lab for my intro to programming class that I am having some difficulty with.  The assignment is to create a program in Small Basic where a teacher can enter a Students name, enter multiple grades for that student, then when the teacher does not have another grade for that student, to have the program return an average of all the grades entered.  The program should then prompt the teacher if they have another student's grade to enter.  It's supposed to help us understand "while" loops, however, our teacher did not explain much about how to begin this process or how to calculate averages for something such as this... It's all very confusing and several of us (those of us who are GENUINELY beginners to programming...) are having issues with the assignment.  Any assistance would be greatly appreciated! Here is one of my many attempts at creating this program:

    Continue = "no"
    If Continue <> "no" Then
      Grade=""
      While(Grade<>"")
        TextWindow.Write("Enter the name of the student: ")
        Name=TextWindow.Read()   
        TextWindow.Write("Enter a grade: ")
        Grade=TextWindow.ReadNumber()
        x=array.getitemcount("Grade")
        y=array.getvalue("Name" , "Grade")
        Textwindow.WriteLine(Name + "'s total grade is: " + y/x)
      EndWhile
      TextWindow.Write("Do you have another student?: [yes] [no]")
      Continue=TextWindow.Read()
    EndIf

    I know I am doing something very wrong with this program, I just don't know what... I don't want the answer just GIVEN to me, but any hints or tips would be great.

    Regards,

    James

    • Moved by Youen Zen Monday, July 22, 2013 10:03 AM
    Thursday, July 11, 2013 9:30 AM

Answers

  • Not sure you will get much response here - this is a VB.Net forum.

    Here's a hint: is continue = 'no' at start of if? Look at the previous line. Also look at the test in the while. For the if branch to be taken the test must be true, for the while to repeat the test must be true.


    Regards David R
    ---------------------------------------------------------------
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.

    • Proposed as answer by Mr. Monkeyboy Thursday, July 11, 2013 4:02 PM
    • Marked as answer by Just Karl Monday, September 23, 2013 4:24 PM
    Thursday, July 11, 2013 9:38 AM

All replies

  • Not sure you will get much response here - this is a VB.Net forum.

    Here's a hint: is continue = 'no' at start of if? Look at the previous line. Also look at the test in the while. For the if branch to be taken the test must be true, for the while to repeat the test must be true.


    Regards David R
    ---------------------------------------------------------------
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.

    • Proposed as answer by Mr. Monkeyboy Thursday, July 11, 2013 4:02 PM
    • Marked as answer by Just Karl Monday, September 23, 2013 4:24 PM
    Thursday, July 11, 2013 9:38 AM
  • Thanks, I reposted it in the small basic area.  I got the continue part fixed too.  Thanks for the tip

    Regards,

    James

    Thursday, July 11, 2013 3:13 PM
  • James...

    Sorry to bother you, but looking through your questions from some time ago..It was implied there was a specific Microsoft Small Basic Forum and I cant seem to find it.

    Could you give me a link to it ? If so... that would be great.

    But would you also know the asnwer to whether you can run another Small Basic Program immediately after one program finishes? I am not looking to return to the original one but I am curious whether you could do that too.

    Thanks if you can help on both fronts.

    Dave

    Thursday, December 4, 2014 9:36 AM