From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f4331623dbc3161 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-17 08:58:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!wn14eed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail From: "Steve Doiel" Newsgroups: comp.lang.ada References: <3c949e41$0$7409@motown.iinet.net.au> Subject: Re: if statement X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: NNTP-Posting-Host: 12.225.227.101 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1016384301 12.225.227.101 (Sun, 17 Mar 2002 16:58:21 GMT) NNTP-Posting-Date: Sun, 17 Mar 2002 16:58:21 GMT Organization: AT&T Broadband Date: Sun, 17 Mar 2002 16:58:21 GMT Xref: archiver1.google.com comp.lang.ada:21371 Date: 2002-03-17T16:58:21+00:00 List-Id: "Karl-Johan Karlsson" wrote in message news:3c949e41$0$7409@motown.iinet.net.au... > > 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); > ... > Try this (you were almost there) elsif Choice = Item3 then Sum := Item_Amount * Item_Type; if Item_Amount < 2 then Sum := Sum + Postage_Charge; end if; Put("$"); Put(Sum, 1, 2, 0); end if > Also, I am using Ada98, not Ada83 under Win98. Presumably you mean Ada95 :-) SteveD