IPT - A Virtual Approach IPT A Virtual Approach by Peter Whitehouse
Quick Links:
 
 
Information and Intelligent Systems Social and Ethical Implications Human Computer Interaction Software and Systems Engineering eXercise Files Course Outline and Assessment A-Z of Geeky Acronyms Terrace Work Program 2004 Sillybus FAQ = Frequently Asked Questions Help
 
 

eXercise #19

Simple Visual System Case Study:
MuckDonalds Family Restaurant
(things that make you go mmmmm...)

You are required to create a simple to operate (let's face it, being a checkout life-form is not rocket science) menu system that allows users to place an order for a set number of products, calculates subtotals, accepts cash and issues change. Sounds simple ....?

The interface should resemble the following:

MuckDonalds Menu
run | cheat

There are a number of things to notice about how the above system works...

  • The number pad allows us to enter the amount tendered by the customer (one way to userproof the system without using an edit box). All of the keys have the SAME onClick event handler based on the caption of the button.

    An edit box could be used but a mechanism would be necessary to prevent the user from typing in non-numeric information and crashing the program. A crash-resistant edit box will be discussed in class.

  • the [+] and [-] buttons either increment or decrement the number of each product. Interestingly, they all have the SAME onClick event handler (featuring a multiple selection) based on the name of the button. This was thought better than 10 different event handlers that do almost the same job.

  • The project uses CONSTANTS for the prices of the products - these are declared at the beginning of the IMPLEMENTATION section.

  • The project uses VARIABLES (byte and real) for the product tallies and the product sub-totals. This reduces the amount of inttostr/strtoint and floattostr/strtofloat conversions and also means the form is merely a reflection of the order and not actually storing it (if that distinction is clear).

    The FloatToString conversion for currency values is handled differently using the currency conversion: floattostrF(thing, ffcurrency,7,2);

    • floattostrF: the formatted conversion builtin function
    • thing: the floating point variable being converted into currency display
    • ffcurrency: the builtin currency format (includes the decimal point)
    • 7: a value indicating it is a single precision real currently
    • 2: the number of relevant decimal places


    There are many ways to do the display conversion, including some code-intensive string manipulation routines, but this seemed most direct.

  • The [serve] button calculates change and is error trapped to ensure sufficient funds are entered, the [clear] button erases the amount tendered (assuminng the operator has made an error); the [new order] button resets the form ready for a new order. If care is taken, routines used can be recycled for other aspects of this system.

wonko@wonko.info
©Copyright t 1992..2017+. Edition 25.150117
wonkosite
Creative Commons License
This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 2.1 Australia License
.