NZGames.com Forums
Register FAQ Calendar Mark Forums Read

Go Back   NZGames.com Forums > General > Coders' Forum
User Name
Password

Reply
 
Thread Tools
Old 24th August 2004, 00:09     #1
DeathRow
 
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.
  Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



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