Data Dictionary Guide


Home

Pseudo code by itself doesn't provide enough information to be able to write program code. Data Dictionaries are used to describe the data used in the Pseudo Code. Usually this involves describing the variables used.

The data specified is in three columns

  1. the identifier name; a variable or constant name e.g. customerName, count
  2. the data type. The standard data types used are Integer, Double, String, Char and Boolean
  3. a description of the identifier. The identifier descriptions should be brief but meaningful. Try to avoid just restating the name in the description. Specify any units used e.g. length in millimetres. Give example data where it helps the description.

The rows in the table are sorted into alphabetical order on the identifier name.

Example 1 shows a simple Data Dictionary with some typical data types that will be used in this subject. Examples 2 to 4 show Pseudo Code for a problem and associated Data Dictionaries.

Example 1

The following shows the general layout for a simple Data Dictionary.

 
Name Data Type Description
count Integer The number of people employed by the company.
currentEmployee Boolean Flag to indicate if the person is currently employed by the company.
familyName String The family name of an employee.
netWage Double An employees wage after tax has been taken out in $.

Example 2

Pseudo Code

calcGST()
    Input customerName, carPrice
    GST = carPrice * 10 / 100
    Display "GST for ", customerName, "is ", GST
STOP

Data Dictionary

Name Data Type Description
carPrice Integer The price of the car in whole dollars.
customerName String The name of the customer buying the car.
GST Double The Goods and Services Tax on the car in $.

Example 3

Pseudo Code

calcDiscountPrice()
    Input itemPrice
    Input quantitySold
    grossPrice = itemPrice * quantitySold
    Display grossPrice
    IF quantitySold < 10 THEN
        discountPercent = 0
    ELSE
        IF quantitySold < 100 THEN
            discountPercent = 5
        ELSE
            discountPercent = 10
        ENDIF
        discount = grossPrice * discountPercent / 100
        discount = RoundDownToNearestWholeNumber(discount * 100) / 100
        netPrice = grossPrice - discount
        Display discount, netPrice
    ENDIF
STOP

Data Dictionary

Identifier Name Data Type Description
discount Double The dollar value of any discount.
discountPercent Integer The percentage discount on gross price, depending on the quantity sold e.g. 10.5% is 10.5.
grossPrice Double The total price before any discounts in $.
itemPrice Double The price of a single item before discount in $.
netPrice Double The total price after discount in $.
quantitySold Integer The number of an item sold.

Example 4 (Using Subroutines)

calcDiscountPrice()
    inputItemPrice()
    inputQuantitySold()
    grossPrice = itemPrice * quantitySold
    Display grossPrice
    calcDiscount()
STOP

Data Dictionary

Identifier Name Data Type Description
discount Double The dollar value of any discount.
discountPercent Integer The percentage discount on gross price, depending on the quantity sold.
grossPrice Double The total price before any discounts.
itemPrice Double The price of a single item before discount.
netPrice Double The total price after discount.
quantitySold Integer The number of an item sold.

inputItemPrice()
    Input itemPrice
    WHILE itemPrice < 0 DO
        Display error message
        Input itemPrice
    ENDWHILE
EXIT

inputQuantitySold()
    Input quantitySold
    WHILE quantitySold <= 0 DO
        Display error message
        Input quantitySold
    ENDWHILE
EXIT

calcDiscount()
    IF quantitySold < 10 THEN
        discountPercent = 0
    ELSE
        IF quantitySold < 100 THEN
            discountPercent = 5
        ELSE
            discountPercent = 10
        ENDIF
        discount = grossPrice * discountPercent / 100
        discount = RoundDownToNearestWholeNumber(discount * 100) / 100
        netPrice = grossPrice - discount
        Display discount, netPrice
    ENDIF
EXIT


Written by Tim Whitfort.