Page 308 - Open Soource Technologies 304.indd
P. 308

Event Driven Programming






































                                                              Fig. 14.4

                          14.3  Sample  Project  Specifications

                          We must build a form so that the user at the Order Desk can input a customer’s purchases. The
                          user will input the customer’s name and will select the customer’s city from a list of 5 cities that
                          will be shown to him. If the customer is from ‘Capital City’ he must pay 8% tax on his purchases
                          otherwise, there is no tax. The user will then input from 1 to 3 items that the customer purchased
                          along with the price of each item. The maximum price for an item is 50. Anything over that is
                          ‘Too big’. If there is a price entered for an item there must be a description also. If an item is
                          being returned instead of purchased, the price will be negative and a red flag with the word
                          ‘Credit’ will appear next to the price. When the user hits the ‘Calculate’ button, the subtotal, the
                          tax payable and the final total will appear. There must be the usual buttons to clear the form
                          and to exit when finished. There is also a need for a menu function to be able to cut, copy and
                          paste text from different parts of the form. The first thing to do is to create all the required
                          controls. However, because the items and the prices are a special case, don’t do them yet. This
                          form should look something like this:
                          14.4  Building a Calculator with Visual Basic


                          Microsoft Visual Basic is a programming language based on the BASIC language, originally
                          developed to make programming easier to learn. Visual Basic takes the familiar commands of
                          BASIC and adds object-oriented tools and interfaces for designing WYSIWYG-like Windows
                          applications and web controls, among many other enhancements. One relatively simple learning
                          project for Visual Basic is the creation of a Windows calculator.


                          302                    LOVELY PROFESSIONAL UNIVERSITY
   303   304   305   306   307   308   309   310   311   312   313