IGCSE Computer Science 0478/23 Problem-solving and Programming October/November 2022 Notes
Pre-release Material: Window Cleaning Company Management System
System Purpose: A program designed for a window cleaning company to store service details for each job, generate itemised bills for customers, and analyze service popularity.
Service Pricing and Calculation Order: Costs are applied in the specific order listed in the table.
Basic window clean (outside, one floor, up to five windows):
Additional windows (up to and including five more):
Service on two floors: extra
Service on three floors: extra
Inside cleaning included: extra
Polish all windows cleaned: extra
Special solar panel clean:
Calculation Example: A customer with six windows over three floors.
Base cost ( windows):
Additional windows ( window):
Subtotal:
Three floors adjustment ( extra):
Total Bill:
General Programming Requirements:
Validation on all data entry.
Meaningful names for all variables, constants, and identifiers.
Clear and understandable outputs and error messages.
System Implementation Tasks
Task 1 – System Setup and Data Storage:
Customer names and addresses must be stored in a single-dimensional array.
The array index of the customer's entry serves as the unique itemised bill number.
Service requirements are stored in separate arrays (one for each service) at the same index as the customer details.
Task 2 – Service Recording and Billing:
The program must display available services and their respective costs.
Functionality to input and store customer details and specific service requirements.
Automatic calculation of the total cost based on the established pricing rules.
Display of the itemised bill, including the unique bill number and total cost.
Provision for repeating the process for multiple customers.
Task 3 – Statistics and Analysis:
The system must identify the most popular and least popular services, excluding basic cleaning and additional windows.
Output requirements for these two services include:
Service name.
Status (most or least popular).
Frequency of use expressed as a percentage of the total bills stored:
Programming Principles and Problem Solving
Constants in Programming:
Example identifiers:
BasicClean,SolarPanelCost,TwoFloorPremium.Values:
BasicClean= ,SolarPanelCost= ,TwoFloorPremium= .Rationale for constants: Prices or percentage rates remain static throughout the program's execution, preventing accidental value changes and making the code easier to update if rates change globally.
Array Management for Customer Details:
Name:
CustomerDetailsorCustAddress.Data Type: String (to accommodate alphanumeric address data).
Sample Data: "J. Smith, 22 Acacia Avenue, Anytown".
Selection Logic for Floor Levels:
To ensure only one floor option (two vs. three) is selected, a program can use a single variable (e.g.,
NumFloors) and validate it to accept only values .Alternatively, an
IF...THEN...ELSE IFstructure ensures that if the condition for "two floors" is met, the "three floors" condition is skipped.Boolean flags can also be used with mutual exclusivity logic (e.g.,
IF TwoFloors = TRUE THEN ThreeFloors = FALSE).
Statistics Algorithm Details (Task 3)
Processing Popularity:
Counters are initialized for each eligible service (e.g.,
InsideCount,PolishCount,SolarCount).The program iterates through the service arrays using a
FORloop from index 1 to the total number of bills.Within the loop,
IFstatements check if a service was selected (e.g.,IF Inside[Index] = TRUE THEN InsideCount ← InsideCount + 1).After the loop, the counts are compared using selection statements to find the maximum and minimum values.
The percentage is calculated by dividing each count by the total bill count and multiplying by .
Pseudocode and Data Entry Algorithms
Array Initialization:
FOR Count ← 1 TO 50sets all elements in a storage array to zero to clear previous data.
Range Validation and Frequency Counting:
The algorithm accepts inputs between and inclusive.
Termination conditions: Input of OR entering valid numbers.
Frequency tracking:
Reading[Value] ← Reading[Value] + 1increments the counter at the index corresponding to the input value.
Output Modification:
to change an output from ascending (lowest first) to descending (highest first), the
FORloop orREPEATloop counter must be decremented (e.g.,FOR Count ← 50 TO 35 STEP -1).
Validation and Check Digits
Check Digit Calculation Process:
Sum the first five digits of the identification number.
Divide the total by .
Find the remainder.
The remainder serves as the sixth (check) digit.
Calculation Example: For ID
69321.Step 1 (Sum):
Step 2 (Division): remainder
Step 3 (Resulting ID):
693211
Validation Identification:
ID
722855: Sum is . Remainder is . Check digit is incorrect.ID
231200: Sum is . Remainder is . Check digit is incorrect.
Limits of Simple Sum Check Digits:
This specific algorithm fails to detect transposition errors (e.g., entering
512instead of152) because the sum remains identical.A more robust algorithm involves weighted values (e.g., multiplying each digit by its position before summing) like in ISBN or EAN systems.
Additional Validation Checks:
Length Check: Ensures exactly six digits are entered.
Type/Character Check: Ensures only numeric digits are entered.
Range Check: Ensures the ID falls within a predefined numerical range.
Process Flow and Inventory Logic
Wheelbarrow Stock Management:
Initial values:
Stock ← 10,Total ← 0.When a sale is recorded (
Sale = "Y"),Stockdecreases by andTotalsales increase by .Reordering threshold: If
Stock < 5, thenStock ← Stock + 10(simulating new stock delivery).Process ends when
Sale = "N".
Expanding Inventory Systems: To allow multiple unit sales, the input should change from "Y/N" to an integer quantity. The algorithm would then subtract the quantity from
Stockand add the quantity toTotal, providedQuantity ≤ Stock.
Database Management
Table Structure (MUSEUM):
ItemCode: Unique identifier for items (e.g.,ART0005).Description: Text description.InStore: Boolean/Character representing if the item is present (Y/N).Century: Numerical record of origin time (e.g.,18).Country: String of origin country.
Primary Keys:
ItemCodeis the ideal primary key because it is unique to every record, ensuring no two items have the same identifier.Query-By-Example (QBE): To find specific items not in store:
Fields selected:
Description,Country.Filter (Criteria) on
InStorefield:"N"or≠ "Y".Show property: True for
DescriptionandCountry; False forInStore.