Answered by:
Program for final help

Hello!
Im fairly new to small basic so apologies if my questions don't make sense. For my Computer Science class in high school, my final exam is to make a program that give information based on a number the user enters. (this is all through graphics window btw). As I was using graphics Window, I was having trouble setting it up where the number that the user inputs it brings them to a whole new graphics window. The user enters the number in a text box. I tried using properties in Controls, to put the user input as a variable, but a new program would never come up. I tried using Controls.SetTextBoxInput and GetTextBoxInput. If anyone understands what I am trying to ask, and would gave an idea, please all answers are appreciated. Remember, Im just a high school student using Small Basic for the first time, so please try to be as simple as possible. If my question is confusing just tell me and i will try to rephrase it
Thank You so much!:)
Question
Answers

payton1225,
We can't do homework for you, but here is a snippet that might help you get started:
inBox=controls.AddTextBox(100,100)
outBox=controls.AddTextBox(300,100)
Controls.texttyped=ontexttypedSub ontexttyped
MyNum=Controls.GetTextBoxText(inBox)
Controls.SetTextBoxText(outBox,"Number is: "+MyNum)
endsubJust type something in the first textbox and you will see "Number is:" and the number appear in the second textbox. In Small Basic there is only 1 graphics window. I hope this helps you get started.
JR
 Marked as answer by YLedEditor Sunday, January 22, 2017 2:29 PM
All replies

payton1225,
We can't do homework for you, but here is a snippet that might help you get started:
inBox=controls.AddTextBox(100,100)
outBox=controls.AddTextBox(300,100)
Controls.texttyped=ontexttypedSub ontexttyped
MyNum=Controls.GetTextBoxText(inBox)
Controls.SetTextBoxText(outBox,"Number is: "+MyNum)
endsubJust type something in the first textbox and you will see "Number is:" and the number appear in the second textbox. In Small Basic there is only 1 graphics window. I hope this helps you get started.
JR
 Marked as answer by YLedEditor Sunday, January 22, 2017 2:29 PM

This portion of the final exam review focuses on the Text Window. You will need to write a program that utilizes variables, loops and conditional statements. When you are done with this portion, submit your sb file and move on to part 2.
Step One:
· The program will begin with a menu that displays the following options:
_· Welcome to the grade calculator!
o 1– What do I need to get on the final exam?
o 2 – Grade Calculator
o X – Exit the program
§ This menu should call the appropriate subroutine using conditional statements, exit the program, and also check for an invalid user input.
Step Two:
finalExamCalculator Subroutine
This portion of the program will allow a student to figure out what they need to earn on the final exam in order to achieve the desired grade.
 You will first ask the user what their current grade in class is and store that number in the variable currentGrade
 You will then ask the user what they want their overall grade to be in class and store that number in the variable overallGrade
 You will then calculate what they need to earn on the final exam in order to achieve the desired overall grade using the following formula:
 Display your output as “You will need to earn a EXAMGRADE % in order to achieve a OVERALLGRADE %”
 After you calculate the exam grade, you will check to see if it is over 100%. If the exam grade needed is over 100%, then you will display “Sorry! That’s impossible! L”
 See the diagrams below for further explanation and for numbers to check the functionality of your program.
 The program should return back to the main menu after completing the calculation
Step Three:
gradeCalculator Subroutine
The Riverview High School staff is looking for a quick way to calculate the grades for their final exams. Your task is to write a program that accomplishes the following:
 Ask the teacher how many questions were on the test. Store this in the variable totalQuestions.
 Ask the teacher how many students took the test. Store this in the variable numberOfStudents.
 Ask the teacher how many questions were wrong (loop this is as many times as the number of students who took the test). Store this in the variable numberWrong. Calculate the numberCorrect based on this number as well as the totalQuestions
 Calculate the percent grade for that student. Store this in the variable currentGrade. (numbercorrect/totalQuestions *100)
 ·Add this number to the total sum of the grades. (sumofgrades = sumofgrades + currentgrade)
 Tell the teacher the percent grade rounded AND letter grade that the student earned.
o If the grade is greater than or equal to 93, then the student earned an A.
o Else if, the grade is greater than or equal to 90, then the student earned an A.
o Else if, the grade is greater than or equal to 87, then the student earned a B+.
o Else if, the grade is greater than or equal to 83, then the student earned a B.
o Else if, the grade is greater than or equal to 80, then the student earned a B.
o Else if, the grade is greater than or equal to 77, then the student earned a C+.
o Else if, the grade is greater than or equal to 73, then the student earned a C.
o Else if, the grade is greater than or equal to 70, then the student earned a C.
o Else if, the grade is greater than or equal to 67, then the student earned a D+.
o Else if, the grade is greater than or equal to 63, then the student earned a D.
o Else if, the grade is greater than or equal to 60, then the student earned a D.
o Else, the student earned an E.
 When the teacher is done entering grades, the program will display the class average.
o The average equals the sum of the grades divided by the number of students who took the test.
 The program will return to the main menu upon completion of the class average.
 See the diagrams below for further explanation and for numbers to check the functionality of your program.
Hint: You will need to have variables for: The number of students who took the test, the number of questions on the test, the number wrong, the number correct, the grade (rounded), the sum of the grades, and the average.
Use the following diagram as a guide: