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
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.
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 $. |
calcGST()
Input customerName, carPrice
GST = carPrice * 10 / 100
Display "GST for ", customerName, "is ", GST
STOP
| 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 $. |
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
| 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. |
calcDiscountPrice()
inputItemPrice()
inputQuantitySold()
grossPrice = itemPrice * quantitySold
Display grossPrice
calcDiscount()
STOP
| 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