From: "MYC" <fartmanx@hotmail.com>
Subject: About a design for a supermarket POS (Point of Sale System)
Date: Fri, 2 Mar 2001 17:18:02 -0000
Date: 2001-03-02T17:18:02+00:00 [thread overview]
Message-ID: <97okk9$ll29@tech.port.ac.uk> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3126 bytes --]
Dear Sir,
I have some problems about Ada. I am not sure whether it is correct. Would
you help me check it? Thank you very much.
��The exercise is to write a design for the solution of the problem, which
simulates aspects of a supermarket POS (Point of Sale System), while the
design should consist of Ada or pseudo code for the main procedure, a
definition of all user defined types, a definition of the arrays and / or
records used and for each subprogram proposed in this solution including the
name of the subprogram, an English description of what it does and the data
passed into and out of the subprogram.
Also, the user enters an 8 digit binary number (the bar code), which is
converted to a decimal equivalent. This decimal value can be used to locate
the data for the product.
Moreover, the program is menu driven requiring the following options:
Process a shopping basket of goods
Modify or add new product details
Run off a product inventory by bar code order
List product details in alphabetic product name order
Report on any product below the (user supplied) re-order level��
Example data and program requirements
BINARY CODE PRODUCT PRICE QUANTITY
0000 0001 COFFEE 2.75 27
0000 0010 BREAD 0.44 120
0000 0011 MILK 0.89 47
0000 0100 Nil 0.00 0
1111 1100 LIME PICKLE 1.59 30
1111 1101 Nil 0.00 0
1111 1110 BASMATI 3.99 67
1111 1111 TOM YUM 0.55 32
============================================================================
=
My solution is as follows:
1. User Defined Data Types
type PRODUCT_TYPE IS
subtype BINARY_CODE is STRING (1..8)
subtype NAME is STRING (1..12)
subtype PRICE is FLOAT range 0.00..1000.00
subtype QUANTITY is STRING range 0..1000
type MENU IS (PROCESS, MODIFY, ADD, DISPLAY1, DISPLAY2, REPORT, QUIT)
2. Data Structures �C Records and Arrays
Record to represent a product:
type PRODUCT is a record
BAR-CODE : INTEGER
DESCRIPTION : NAME
VALUE : PRICE
RESTOCK : QUANTITY
KIND : PRODUCT_TYPE
end record
ITEM : PRODUCT;
Array of products:
type PRODUCTS is array (1,..1000) of PRODUCT
3. Ada Based Design for Main Procedure
Procedure POINT_OF_SALE_SYSTEM is
THE_PRODUCTS: PRODUCTS
begin
CREATEPRODUCTS;
loop
DISPLAYMENU;
GET(MENU_CHOICE);
exit when MENU_CHOICE = QUIT
case MENU_CHOICE is
when PROCESS T PROCESS_SHOPPING_BASKETS
when MODIFY T MODIFY_PRODUCT_DETAILS
when ADD T NEW_PRODUCT
when DISPLAY1 T DISPLAY_PRODUCTS_BY_BARCODE_ORDER
when DISPLAY2 T DISPLAY_PRODUCTS_BY_ALPHABETIC_NAME_ORDER
when REPORT T REPORT_REORDER_LEVEL
when OTHERS T PUT(��Unexpected menu choice!!��)
end case
end POINT_OF_SALE_SYSTEM
4.Subprograms Required
CREATEPRODUCTS
Description
Initializes the array THE_PRODUCTS
NEWPRODUCT
Description
Procedure to allow user to add a new product to the system
GET(A_PRODUCT: out PRODUCT)
Description
Procedure to prompt user to input full details of a product
============================================================================
===
next reply other threads:[~2001-03-02 17:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-02 17:18 MYC [this message]
2001-03-02 19:02 ` About a design for a supermarket POS (Point of Sale System) Marin David Condic
2001-03-02 19:26 ` Ken Garlington
2001-03-03 3:40 ` Gerhard Häring
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox