Discussion Locked

If, Then, Else Statement

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am writing a program to calculate student grades. Students receive bonus points for Extra credit work and they also receive penalty for late submission of work.

my statement goes something like
if radxxxxxx.visble = true then txtxxxxxxx.value- numxxxxx.value + 5 (or minus) depending on the radio button I am working with.

I am not sure if anyone can give me assistance based on this scenario but if someone can I'd be grateful.

5 replies

by amanabala

Hello,

I am assuming that there are a set of radio buttons, corresponding text boxes(2 sets).
If you put the radio buttons and the text boxes in arrays (depending on the programming language, how you achieve this will change).
When you use arrays, your statement will look like
in VB
indx = rad.selectedIndex
if indx = 1 then ' Extra credit
extra=5
else if indx=2 then
extra =-5
end if

grade = txt(indx)-num1(indx)+extra

wher your radio button array is called rad,
txt is the name of the text box array and num1 is the name of the values array

If you can give me more specifics, may be I can give a detailed answer.

regards,
Ravi
ananth_manabala@yahoo.com

This discussion is closed to new replies.