Function?Procedure? - Programmers Heaven

#### Howdy, Stranger!

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

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# 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