-
Help
I need to design a program that for 12 ficticous people, the age can be worked out from the birth date.
Also, included in the program will be a way to work out the average exam score from a total of seven results. I have already designed this part but am having problems coding it and don't know how to link it to the rest
I am very new to programing and desperately need help
Cheers
wardy
-
You could make an UDT like this one:
Code:
Type student
name as string
birth as date
exams(6) as integer
end type
for storing the data, then you could declare the fictious people like this
Code:
Private people(12) as student
and get the age of the x'th student:
Code:
Age=datediff("yyyy",people(x),now)
and the average:
Code:
dim n as integer,average as integer
For n=0 to 6
average=average+people(x).exams(n)
next n
average=average/7
-
Thanks for the great help
i'm not sure what objects i will need on my form, for example; will i need any command boxes e.t.c
Sorry if sound like a fool but as i say i am new to programming. Unfortunately my teacher at school does'nt care and thinks it would be fun for me to learn how to program in my summer holiday
-
Actually that depends on you, the interface you want to design, but i could help you.
make a listbox for the list of students
make another for exams
make three textboxes, for the name, the birthdate and the selected exam points.
make three commandbuttons, for adding a student, for applying the exams scores, for checking the age and the average score.
-
If your exam is going to be out of 100%, then do not declare it as an Integer; declare it as a Byte instead. It will consume less memory.
Code:
Type Student
strName As String
dteBirth As Date
Exams(6) As Byte
End Type