From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: ** X-Spam-Status: No, score=2.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, DEAR_SOMETHING,PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,4309dfdbbca8d45a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-02 11:18:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: About a design for a supermarket POS (Point of Sale System) Date: Fri, 2 Mar 2001 14:02:09 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <97oqot$7d7$1@nh.pace.co.uk> References: <97okk9$ll29@tech.port.ac.uk> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 983559773 7591 136.170.200.133 (2 Mar 2001 19:02:53 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 2 Mar 2001 19:02:53 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.lang.ada:5381 Date: 2001-03-02T19:02:53+00:00 List-Id: This clearly looks like a homework problem. Generally, we're willing to help with homework assignments if you have a) made an honest effort to find the answer through traditional means and b) have a *SPECIFIC* question in mind. Seeing as how you have at least attempted a solution, it doesn't look like you are asking us to do your homework for you. However, your question is pretty broad and vague. Is there some particular part of this that has you confused? Also, for some reason your code has no indentation. This makes it terribly hard to look at. Try to get it to the newsgroup as plain ASCII with spaces instead of tabs & maybe it will appear correctly. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "MYC" wrote in message news:97okk9$ll29@tech.port.ac.uk... > 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 > ============================================================================ > === > > > > > >