O Level & IGCSE Computer P2 Workbook by Inqilab Patel

Page 149

149 | P a g e

/04

PSEUDO CODE FOR TASK 3 //Declaration of constants & variables CONSTANT CPrice=3 CONSTANT GPrice=2 CONSTANT SPrice=2 CONSTANT SpecialPrice=10 DECLARE RegularPrice, DiscountPrice, AmountSaved:Real DECLARE C, G, S, SpecialPack:Integer

//Calculation of regular price RegularPrice  (COrder x CPrice) + (SOrder x SPrice) + (GOrder x GPrice) PRINT "Total Price of order = " , RegularPrice

//Initialization of temporary variables and SpecialPack C  COrder G  GOrder S  SOrder SpecialPack  0

//Calculation of number of special packs in order WHILE C>=1 AND S>=2 AND G>=2 DO SpecialPack  SpecialPack + 1 C  C - 1 S  S – 2 G  G – 2 ENDWHILE

//Calculation of discount price & amount saved IF SpecialPack>=1 THEN DiscountPrice  (SpecialPack * SpecialPrice) + (C * CPrice) + (S * SPrice) + (G * GPrice) AmountSaved  RegularPrice – DiscountPrice PRINT "Discount Price of order = " , DiscountPrice PRINT"Amount Saved on discount = " , AmountSaved ENDIF


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.