Check this

Sunday, March 26, 2017

Solution of pre release May 2017 Computer Science 2210 O Level,0478 IGCSE



DO

    INPUT "Enter the no of senior citizens ", NSC

    IF NSC < 10 OR NSC > 36 THEN

       PRINT "Invalid number of citizens"

    END IF

LOOP UNTIL NSC >= 10 AND NSC <= 36

IF NSC <= 14 THEN

    TotalPerson = NSC + 2 
    MaxCapacity = 16

    CoachCost = 150 
    MealCost = 14 * TotalPerson

    TicketCost = 21 * TotalPerson

ELSEIF NSC <= 24 THEN

    TotalPerson = NSC + 2 
    MaxCapacity = 26

    CoachCost = 190 
   MealCost = 13.5 * TotalPerson

    TicketCost = 20 * TotalPerson

ELSE     TotalPerson = NSC + 3 
   MaxCapacity = 39

    CoachCost = 225
  MealCost = 13 * TotalPerson

    TicketCost = 19 * TotalPerson

END IF

TotalCost = CoachCost + MealCost + TicketCost

CostPerPerson = TotalCost / NSC

PRINT "No of People going for the outing including Carers ==> ", TotalPerson

PRINT "Total cost of the trip ==> ", TotalCost

PRINT "Cost per citizen ==> ", CostPerPerson

DIM NameofPerson(MaxCapacity) AS STRING

IF NSC <= 14 THEN

    ExtraPeople = 14 - NSC

    MoneyCollected = ExtraPeople * CostPerPerson

ELSEIF NSC <= 24 THEN      ExtraPeople = 24 - NSC

    MoneyCollected = ExtraPeople * CostPerPerson

ELSE

    ExtraPeople = 36 - NSC

    MoneyCollected = ExtraPeople * CostPerPerson

END IF

For I = 1 to  MaxCapacity

INPUT "Enter Names for outing: ", NameofPerson(i)

Next  I

For I = 1 to  MaxCapacity

Print  NameofPerson(i)

Next  I

IF NSC <= 14 THEN

    ExtMealCost = ExtraPeople * 14

    ExtTicketCost = ExtraPeople * 21

ELSEIF NSC <= 24 THEN

    ExtMealCost = ExtraPeople * 13.5

    ExtTicketCost = ExtraPeople * 20

ELSE

    ExtMealCost = ExtraPeople * 13

    ExtTicketCost = ExtraPeople * 19

END IF

Profit = MoneyCollected - (ExtTicketCost + ExtMealCost)

IF Profit = 0 THEN

    PRINT "The trip has just broken even"

ELSE

    PRINT "The trip has made a profit of ", Profit

END IF

No comments:

Post a Comment

Printing steps of 3D Printer

Printing steps of 3D Printer 1 A design is made using CAD software 2 A software mak...