From: Pheet <a.pheet@ntlworld.com>
Subject: Re: if statement
Date: Tue, 19 Mar 2002 19:23:38 +0000
Date: 2002-03-19T19:23:38+00:00 [thread overview]
Message-ID: <3C97903A.380765CC@ntlworld.com> (raw)
In-Reply-To: 3c949e41$0$7409@motown.iinet.net.au
Karl-Johan Karlsson wrote:
>
> Hello to group.
>
> I am currently writing a little program that determines how much a
> customer's total cost will be for buying either Item1, Item2, Item3
> multiplied by the amount purchased (customer cannot purcase a combination
> of items, just one at any amount). If the customer buys more than one
> of Item3 the postage price is FREE. This is where I have confronted trouble
> as when Item3 at two or more units purchased is inputted into the
> program, the output displays two costs (cost with delivery, cost
> without delivery) where I desire only the cost without delivery
> to be displayed. I know this is because the code below needs to
> be altered, but I am not sure how to go about doing it so I
> require help.
>
> (There are if, elsif entries for Item1, Item2 prior to this code)
>
> ...
> elsif Choice = Item3 then
> Sum := Item_Amount * Item_Type + Postage_Charge;
> Put("$");
> Put(Sum, 1, 2, 0);
>
> if Item_Amount > 1 then
> Sum := Item_Amount * Item_Type
> Put("$");
> Put(Sum, 1, 2, 0);
> ...
>
Hi, I think you might try this:
...
elsif Choice = Item3 then
if Item_Amount > 1 then
Sum:=Item_Amount * Item_Type;
else
Sum:=Item_Amount+Postage_Charge;
end if;
Put("$");
Put(Sum,1,2,0);
end if;
...
HTH,
Pheet
next prev parent reply other threads:[~2002-03-19 19:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-17 13:46 if statement Karl-Johan Karlsson
2002-03-17 16:58 ` Steve Doiel
2002-03-19 19:23 ` Pheet [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-03-20 6:05 Christoph Grein
2002-03-21 6:25 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox