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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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-19 11:23:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newspeer.clara.net!news.clara.net!peernews!peer.cwci.net!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail Message-ID: <3C97903A.380765CC@ntlworld.com> From: Pheet Reply-To: psa1@brighton.ac.uk X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: if statement References: <3c949e41$0$7409@motown.iinet.net.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 19 Mar 2002 19:23:38 +0000 NNTP-Posting-Host: 80.1.84.107 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1016565785 80.1.84.107 (Tue, 19 Mar 2002 19:23:05 GMT) NNTP-Posting-Date: Tue, 19 Mar 2002 19:23:05 GMT Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:21465 Date: 2002-03-19T19:23:38+00:00 List-Id: 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