Dear Sir / Madam,

Please help me again on Delphi. Please help me to write a program that uses a function to caoculate the commission payable to the sales person, when passed the commission rate for the item, the total items sold and the price per item.
For example, if the commission rate was 2%, the total items sold was 5, and the price per item was $1200, then the function should return 120.

Cheers,

Recommended Answers

All 2 Replies

See we can help you out only when you get stuck in somewhere writing a code. It's your task to write the program.

Good luck,guy :)

program commission_rate;

{$APPTYPE CONSOLE}

uses
  SysUtils;
Var CoRate,ItSold,Prc:Integer;

(*this is our little function that will calculate the results*)
Function Something(CommissionRate,ItemsSold,Price:Integer):Real;
   Begin
      Something:=((Price/100)*CommissionRate)*ItemsSold;
   End;

Begin {main}
   {gathering data}
   Write('Give me the commission rate,only numbers: ');
   ReadLn(CoRate);
   Write('Now,give me the price of the item,only numbers: ');
   ReadLn(Prc);
   Write('And lastly,give me the number of the sold items: ');
   ReadLn(ItSold);
   {call our function,write the results}
   Write('The final result is: ',Something(CoRate,ItSold,Prc):3:0);
   ReadLn;
End.

{
-=Note By FlamingClaw=-

Of Course,tested.I tryed in Delphi 6 and working....

-=Created By FlamingClaw=-
--=2009.04.04=


}
commented: He helps me a lot. +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.