Final Pre Release CS 2020
Final Pre Release CS 2020
Pseudocode of Task-1
TASK 1-Calculating the price to park.
A customer inputs the day, the hour of arrival excluding minutes (for example 15:45 would be 15), the
number of hours to leave their car, and a frequent parking number if available. If the frequent parking
number has an incorrect check digit, then no discount can be applied. The price to park, based on the day,
the hour of arrival, the number of hours of parking required and any discount available, is calculated and
displayed.
Variables:
Constants:
Hour = (MidDay, MidNight)
Day= Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
THEN MaxStay=2
REPEAT
OUTPUT “Enter Park Time, You can Park for maximum 2 Hours”
INPUT “Enter Park Time=”, ParkTime
UNTIL ParkTime>0 AND ParkTime<= MaxStay
Zohaib
PricePerHour=10
ParkingPrice= PricePerHour * ParkTime
ELSEIF Day=”Sunday”
THEN MaxStay=8
REPEAT
OUTPUT “Enter Park Time, You can Park for maximum 8 Hours”
INPUT “Enter Park Time=”, ParkTime
UNTIL ParkTime>0 AND ParkTime <=MaxStay
PricePerHour=2
ParkingPrice= PricePerHour * ParkTime
ELSEIF Day=”Saturday”
THEN MaxStay=4
REPEAT
OUTPUT “Enter Park Time, You can Park for maximum 4 Hours”
INPUT “Enter Park Time=”, ParkTime
UNTIL ParkTime>0 AND ParkTime<= MaxStay
PricePerHour= 3
ParkingPrice= ParkingPrice * ParkTime
ENDIF
ELSEIF ArrivalTime>=16 AND ArrivalTime <24
ParkingPrice=2
ENDIF
//Choice for FPN
INPUT “Press=1 If you have FPN and Press=0 If you don’t have FPN”, Choice
//Validation of FPN
IF Choice=1
THEN INPUT “Please enter 5 Digit FPN”, FPN
Sum=0
FOR Position= 1 TO 5
Digit=FPN MOD 10
Sum=Sum + (Digit * Position)
FPN =FPN DIV 10
NEXT Position
Remainder =Sum MOD 11
Zohaib
// Calculation of Payable Money on Validation of PFN
IF ArrivalTime>=8 AND ArrivalTime<16
THEN IF Remainder<>0
THEN PRINT “Invalid FPN, No Discount”
MoneyPayable= ParkingPrice
ELSE PRINT “10% Discount available”
Discount= ParkingPrice * 0.1
MoneyPayable=ParkingPrice – Discount
ENDIF
ELSEIF ArrivalTime>=16 AND ArrivalTime<24
THEN IF Remainder<>0
THEN PRINT “Invalid FPN”, No Discount”
MoneyPayable= ParkingPrice
ELSE PRINT “50 % Discount available”
Discount= ParkingPrice * 0.5
MoneyPayable= ParkingPrice- Discount
ENDIF
ENDIF
//Time and Day selection without FPN
ELSEIF Choice=0
THEN OUTPUT “No Discount available without FPN”
IF ArrivalTime>8 AND ArrivalTime<16
THEN MoneyPayable= ParkingPrice
ELSEIF ArrivalTime>=16 AND ArrivalTime<24
THEN MoneyPayable= ParkingPrice
ENDIF
ENDIF
//Final Output
PRINT “Day=”, Day
PRINT “Price To Park=”, MoneyPayable
PRINT ”Hours of Parking=”, ParkTime
PRINT “Arrival Time=”, ArrivalTime
Zohaib
Pseudocode of Task-2
Variables:
DECLARE CurrentTime As STRING
DECLARE DailyTotal, MoneyPaid As INTEGER
DailyTotal =0
MoneyPaid =0
CurrentTime=SystemTime()
IF CurrentTime == ”07:59”
THEN DailyTotal = 0
ELSEIF CurrentTime>= ”08:00” AND CurrentTime < “00:00”
THEN INPUT “Money Paid = ”, MoneyPaid
DailyTotal = DailyTotal + MoneyPaid
ELSEIF CurrentTime == “00:00”
THEN OUTPUT “Daily Total =”, DailyTotal
ENDIF
Pseudocode of Task-3
Task 3 – Making payments fairer.
Customers have complained that sometimes they are being charged too much if they arrive before
16:00 and depart after 16:00. Extend Task 1 to calculate the price before 16:00, then add the evening
charge. For example, a customer arriving at 14:45 on a Sunday and parking for five hours was previously
charged 10.00 and would now be charged 6.00
Variables:
DepartureTime=ArrivalTime + ParkTime
IF DepartureTime>16
THEN ParkTimeBefore16 = 16 - ArrivalTime
MoneyPayableBefore16 = PricePerHour * ParkTimeBefore16
Zohaib
MoneyPayableAfter16 = 2
MoneyPayable = MoneyPayableBefore16 + MoneyPayablrAfter16
IF Remainder=0
THEN DiscountBefore16 = MoneyPayableBefore16 * 0.1
DiscountAfter16 = MoneyPayableAfter16 * 0.5
Discount = DiscountBefore16 + DiscountAfter16
MoneyPayable = = MoneyPayable – Discount
ENDIF
ENDIF
Zohaib