Worked example 1
A bookshop needs to store information about each book: its ISBN (13-digit string), title, author, and price. Define a suitable user-defined data type called TBook.
Show solution outline
Here is the pseudocode definition for the TBook type:
TYPE TBook
DECLARE ISBN : STRING
DECLARE Title : STRING
DECLARE Author : STRING
DECLARE Price : REAL
ENDTYPE
Marking points:
- TYPE TBook and ENDTYPE present. (1 mark)
- At least two correct fields with data types declared. (1 mark)
- All four fields correctly declared with appropriate data types (STRING for ISBN/Title/Author, REAL for Price). (1 mark)