What the App Does
This is a simple app to calculate the tip and total bill at a restaurant – or other service provider where a tip is common place.
This is the third of 5 apps that implement a tip calculator.
- Version 1 introduced the basic app and the use of error checking to handle user data entry mistakes.
- Version 2 introduced the Slider user interface component to select the tip amount. Using the Slider, the user selects a tip from 0% to 30%. Since there is no text entry, it is not possible for an incorrect tip value to be entered.
- Version 3 shows how to re-design the user interface to eliminate user data entry errors. With the new user interface, only correct numeric values may be entered.
- Version 4 introduces “procedures” to clean up the code in preparation for version 5.
- Version 5 revises Version 4 to make the calculation of the tip fully automatic plus fixes some minor oddities.
(Note: I revised the order of new features to appear in Version 4 and Version 5!)
The Tip Calculator User Interface
Version 3 eliminates the text box for entering the amount of the bill for service. Why? A text box allows the user to enter any kind of data, not just numbers – which means the user can enter data values that are not numbers.
By changing the program to use a “numeric keypad” interface, only numeric digits may be entered – and we eliminate potential data entry errors.
You can see how this works in this screen capture showing a calculator like keypad for entering the amount of the bill:
To use, just touch the numbers on the keypad. (There are some minor user interface oddities in this version of the program that will be addressed in version 5 – play with the program and see if you can spot minor problems!)