Simple Loop
Date: 03/10/07
(Javascript Community) Keywords: no keywords
Despite the fact that I'm an Accounting major, I'm in this intro CS class because the school I go to is a bit CS-obsessed.
I've figured out most of the code for this simple program. Basically it asks for the date, asks how many games were played on that date and then asks for the home team name, score, away team name, score and then stops when you've inputted the correct number of games. I'm having problems with two areas (one small and one big) though.
The small one... I need to make the "Basketball Results for x date" part a h1 header. When I tried to do that it didn't work out... I don't know whether I'm just putting the tags in the wrong spot or what.
The big one... we need to figure out the largest margin of victory of the listed games. I'm having a lot of trouble figuring out how to do it. Firstly I'm not sure how to make it always take the highest number and subtract it from the lower one. The only thing I could think of was to get some if statements going... but that seems overly complex for what it needs to do and I'm not even sure it would work. Secondly, I'm not sure how to do it for each game and then only output the biggest one at the end.
In the end it's supposed to output "Higest margin of victory: xpt." after all of the individual game tables have been listed.
I was confused by the tool to make it readable so I just did a screen shot since it's a short code. Hope that's okay!
I know this is probably really basic but thanks for any help!
Source: http://community.livejournal.com/javascript/129427.html