NZGames.com Forums

NZGames.com Forums (https://forums.nzgames.com/index.php)
-   Coders' Forum (https://forums.nzgames.com/forumdisplay.php?f=19)
-   -   n00b VB question.. (https://forums.nzgames.com/showthread.php?t=61686)

DeathRow 24th August 2004 00:09

n00b VB question..
 
hey

currently doing a CIT programme @ unitec and have a programming assignment due in a couple weeks, using vb, which is proving to be a bit harder than i originally suspected.

as yet i do not have a copy of vb on this comp, so im writing it on paper so i can test it next time i goto school... i have this so far, could someone tell me if im heading in the right track..
-
Scenario
You are the marketing manager of Cheapy Software. Your company intends to donate money to the Auckland Starship Hospital. However, the amount of the donation is determined by a fundraising event, which will be held in November.

The fundraising event will be a fun obstacle course, and a donation will be made for every participant who finishes the course in due time. The exact amount of money contributed depends on the age of the participant and the time it took to finish the course. For every participant who finishes in time, the company is committed to donate $10, plus a bonus for every minute the course is finished early (see below). However, the maximum amount donated will be limited to $250 per participant. You are to create a program, to enable the participants to see how much money will be donated on their behalf.

You are to input the name of the participant, their age (in years), and the time taken to complete the obstacle course (in minutes). The user should be able to use the form with either the keyboard or mouse.

The competition is divided into 3 age groups - veterans, seniors and juniors - and the donation is ascertained as follows:

Group - Age(years) - Max Time Allowed - Donation (per min below max time)
Veteran - 35+ - 70mins - $7.50
Senior - 18 - 34 - 50mins - $6
Junior - 17 & under - 40 mins - $8.50
-

Dim Vet as Currency, Snr as Currency, Jnr as Currency, TimeTaken as Double, Age as Long, FirstName as String, LastName as String

FirstName = txtFirstName
LastName = txtLastName
Age = Val(txtAge.text)
TimeTaken = Val(txtTimeTaken.text)
Vet = 10 + (7.5x(70-TimeTaken))
Snr = 10 + (6x(50-TimeTaken))
Jnr = 10 + (8.50x(40-TimeTaken))

If Age <35 then
picResult.Print Vet
Else TimeTaken <70
picResult.Print "Sorry, " FirstName " but time elapsed"
End If

If Age 35<17 then
picResult.Print Snr
Else TimeTaken <50
picResult.Print "Sorry, " FirstName " but time elapsed"
End If

If Age >17 then
picResult.Print Jnr
Else TimeTaken <40
picResult.Print "Sorry, " FirstName " but time elapsed"
End If
-

Thanks to anyone who takes the time to read this and could possibly help me.


All times are GMT +13. The time now is 00:59.

Powered by Trololololooooo
© Copyright NZGames.com 1996-2024
Site paid for by members (love you guys)