Function?Procedure? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Function?Procedure?

Posts: 59Member
For each of the following tasks im not sure if i should use a function or a procedure,help please

1.converting a given number of miles to an equivalent number of kilometres
2.converting a given number of centimetres to feet and inches
3.displaying the names of the best male and female athletes in a race,given a ListBox containing the names and times of all the athletes.
4.computing the nett income given the gross income and the deductions from income.
5.computing a car's kilometres per litre,given the kilometres travelled and the number of litres of petrol consumed.

• Posts: 113Member
: For each of the following tasks im not sure if i should use a function or a procedure,help please
:
: 1.converting a given number of miles to an equivalent number of kilometres
: 2.converting a given number of centimetres to feet and inches
: 3.displaying the names of the best male and female athletes in a race,given a ListBox containing the names and times of all the athletes.
: 4.computing the nett income given the gross income and the deductions from income.
: 5.computing a car's kilometres per litre,given the kilometres travelled and the number of litres of petrol consumed.
:

both are possible but i would do:

1. function MilesToKilometres(AMile: Integer): Integer;
2. procedure CMToFeetInch(ACM: Integer; var AFeet, AInch: Integer);
3. function BestMale: Integer; //returning the index in the listbox
function BestFemale: Integer;
4. function Income(AGross, ADetect: Currency): Currency;
5. function Car(AKilom, APetrol: Integer): Integer

i hope you get an A, but you'd better read your book infront of you again, cause these questions are not really something to ask here.
cheers