Dear Ladies, gents, and lecturers
I know this is schoolboy error type stuff but I am not from a technical background and being my first programming course I could really use a few pointers.
Here is the code I have developed so far for the question 1 of Assignment 4.
The problem is that I cannot even test it. The program runs fine in the debugger but nothing is displayed in the list box when I test the code.
Where am I going wrong? Do I need to declare more variables?
private
{ Private declarations }
procedure Placeorder(nMeal, nBev :Integer; var rCost, rDiscount : Double);
public
{ Public declarations }
end;
var
frmMyProcMCQ: TfrmMyProcMCQ;
implementation
{$R *.dfm}
procedure TfrmMyProcMCQ.Placeorder(nMeal, nBev : Integer; var rCost, rDiscount
: Double);
var
sOrder : String;
const
MealCost = 12.50;
BevCost = 5.00;
begin
rCost:= 0;
rDiscount := 0;
if ((nMeal + nBev)>10) then
rDiscount := 0.1
else if ((nMeal + nBev) >5)then
rDiscount := 0.05
else
rDiscount := 0.0;
rCost := ((nMeal*MealCost) + (nBev * BevCost)) * (1- rDiscount);
lstOrder.Clear;
sOrder := IntToStr(sedMeal.Value) + ' - ' + IntToStr(rgpMeal.ItemIndex);
lstOrder.Items.Add(sOrder);
sOrder := IntToStr(sedBev.value) + ' - ' + IntToStr(rgpBev.ItemIndex);
lstOrder.Items.Add(sOrder);
sOrder := 'Cost: ' + FloatToStrF(rCost, ffCurrency, 15, 2);
lstOrder.Items.Add(sOrder);
sOrder := 'Discount Given :' + FloatToStr(rDiscount);
lstOrder.Items.Add(sOrder);
end;