Pseudocode is a compact and informal high-level description
of a computer programming algorithm that uses the structural conventions of
programming languages, but omits detailed subroutines, variable declarations or
language-specific syntax. The programming language is augmented with natural
language descriptions of the details, where convenient.
Pseudocode resembles, but should not be
confused with, skeleton programs including dummy code, which can be compiled
without errors. Flowcharts can be thought of as a graphical form of pseudocode.
Structured English borrows
heavily from structured programming. It
uses logical construction and imperative sentences designed to carry out
instructions for the action. Decisions are made through IF-THEN-ELLSE-ENDIF and DO-ENDDO
procedures.
Structure English is used for the above said discount
policy problem and is written as below:
START
Add up the number of copies per book title
IF customer is Book-store keeper
THEN
IF the order is > = 6
THEN
Discount=25%
ELSE
Discount = NIL
ENDIF
ELSE
IF Customer is either librarian or individual
THEN
IF the order is > = 50
THEN
Discount = 15%
ELSE
IF the order is > =
20 and < 50
THEN
Discount = 10%
ELSE
IF the order is
>=6 and <20
THEN
Discount = 5%
ELSE
Discount = Nil
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
No comments:
Post a Comment