線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:866
推到 Plurk!
推到 Facebook!

Please help me on Delphi again.

答題得分者是:st33chen
turbomen
一般會員


發表:5
回覆:4
積分:1
註冊:2009-04-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2009-04-04 09:06:02 IP:202.49.xxx.xxx 訂閱
Dear Sir / Madam,

This question ask me to write a program that uses a function to calculate 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.

Please help me on Delphi again.

Cheers,

Tony
st33chen
尊榮會員


發表:15
回覆:591
積分:1201
註冊:2005-09-30

發送簡訊給我
#2 引用回覆 回覆 發表時間:2009-04-07 06:34:17 IP:122.116.xxx.xxx 未訂閱
hi,

the FUNCTION part :

function calc_commission_payable(commission_rate, items_sold, unit_price : real) : real;
begin
result := items_sold*unit_price*commission_rate/100;
end;

is this what you want?
------
IS IT WHAT IT IS
我是 李慕白 請倒著唸.
又想把老話拿出來說, 請用台語發音 : 專家專家全是ROBOT CAR (滷肉腳啦);
都已接手這麼久了, 績效還是那麼爛, 講話還那麼大聲.
turbomen
一般會員


發表:5
回覆:4
積分:1
註冊:2009-04-04

發送簡訊給我
#3 引用回覆 回覆 發表時間:2009-04-08 06:30:01 IP:122.57.xxx.xxx 訂閱
I have got the answer as follow:-

program CommissionRate;
{$APPTYPE CONSOLE}
uses
SysUtils;
Var
CoRate,ItSold,Price:Integer;

Function Something(CommissionRate,ItemsSold,Price:Integer):Real;
Begin
Something:=((Price/100)*CommissionRate)*ItemsSold;
End;
Begin
Write('Please input the commission rate (only numbers): ');
ReadLn(CoRate);
writeLn;
Write('Now,give me the price of the item (only numbers): ');
ReadLn(Price);
WriteLn;
Write('And lastly, give me the number of the sold items: ');
ReadLn(ItSold);
WriteLn;
Write('The final result is: ',Something(CoRate,ItSold,Price):3:0);
ReadLn;
End.


系統時間:2024-05-19 14:42:42
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!