Welcome! Log In Create A New Profile

Advanced

Help with Assignment 4

Posted by tuxstar 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Help with Assignment 4
June 27, 2007 07:17AM
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;
Re: Help with Assignment 4 - SORRY THAT SHOULD BE ASSIGNMENT 5
June 27, 2007 09:14PM
SORRY ALL THAT SHOULD BE ASSIGNMENT 5
Sorry, only registered users may post in this forum.

Click here to login