# Visual Logic



## dontpokeme19 (Apr 16, 2011)

Hi! guys I was just wondering if someone could help me with a Visual Logic problem that I was having. 

(topgrade) Create the logic for a program that accepts student name and 5 grades as input. The five grades are for 5 different exams. Output the name and corresponding top grade for each of the 5 exams. Use procedures to break the program into logical "chunk(s)" if necessary.

I've started my program I already have the name down and I used a for loop in order to allow 5 grades to be input. But I can't figure out how to output the Top grade I know that you can use an array for that but I am not sure how can someone guide me the right away I can post screenshots if possible Thank you =)


----------



## AlbertMC2 (Jul 15, 2010)

Hi

Just to note we are not allowed to help with homework. However we are allowed to point you in the right direction.
I had never heard of Visual Logic before this. So I can only tell you what to try.

1. Create an assignment eg TopGrade = 0
2. During your For Loop use an If Condition to compare the grade you have just entered to the Variable TopGrade (created in 1). If the input is greater than TopGrade then TopGrade = Input value. If Input is Less Than TopGrade then do nothing.


----------



## Ninjaboi (Dec 27, 2010)

Hello dontpokeme19, welcome to TSF!

Albert is correct that we are not able to directly help you with homework, but we can however point you in the right direction. For more on the rules, please go here.

Using Visual Logic, you can easily create output by left-clicking on the flow arrow in your program and selecting 'Output' from the list of items. Double-click the new item that is created by clicking 'Output', and the rest is for you to do.

Source(s):

Visual Logic

Visual Logic - Output


----------



## dontpokeme19 (Apr 16, 2011)

This is what I have so far I need to figure out what the Top grade is an output I attached an example of what I have so far


----------



## AlbertMC2 (Jul 15, 2010)

Hi

Problems:
1. You have created an array (grade) but you do not put the grades into the array.
Your input should rather be: *grade(gd)*
Grade is your array and gd is the number of the item in the array (gd = 0 to 4 = 5 items)

2. When you output your grades you do not output all of them. Once again you will have to output the items from the array by using a similar FOR loop.
Do you have to output all the grades or just the top grade?

Topgrade:
For the topgrade you need to create an IF loop just after the Input of each grade but still in the FOR loop. 
The IF loop condition will be something like grade(gd)>tograde.
Then on the true branch you can have topgrade=grade(gd)
And do nothing on the false branch.
This will compare the grade you have just entered and compare it with the top grade. If the grade you have just entered is larger than the top grade then it becomes the top grade else the top grade remains the same.

Hope this helps.


----------



## dontpokeme19 (Apr 16, 2011)

I figured it out and I put the loops in a method or procedure in order to make it easier to read Thank you for the help It helped me understand how to use arrays and for loops together thanks =)


----------

