In this case, you will create a Visual Basic solution that simulates a program running on a kiosk. This program allows Buzz Advertising to generate ad sales for its weekly shopping deals booklet in a local flea market. Merchants can book their own ads by using this program. This program uses objects created from classes. Use the accompanying graphic file and the instructions below.
Ad price is based on the size of the ad and the location in the shopping deals booklet. Table 1 shows the ad sizes and the price relationship of each size to the base price. Table 2 shows the location markup that must be applied to the calculated price to determine the final price. Prices are calculated as follows:
<price determined by size> * <markup> = <final price>
The base price of an ad is $225.00.
- Business card size ads may only be placed on interior pages. Do not allow the user to selection any location when interior page location is selected.
- The outside back cover is reserved for a full page ad. Do not allow the user to select outside back cover unless full page has already been selected.
|100% of base price
|65% of base price
|40% of base price
Table 1 – Price by Size
|Inside front cover
|Inside back cover
|Outside back cover
Table 2 – Markup by Location
Step 1: Create the Project:
Create a Visual Basic Project using the project name “BuzzAdvertising”.
Step 2 – Design the Form:
Design the form as shown in Figure 1. You will need three button controls, eight radio buttons, two group boxes, seven labels, and one picture box. Load the downloaded bee.jpg image into the picture box. Remove the control box because this program will run in a kiosk.
Step 3 – Create the Ad class
Add a Class file named Ad to the project. The Ad class should have the following properties: company, telephone, run date, size, location, and price. Create a method in the Ad class that calculates the final price of an ad.
Step 4 – Write code in the main form:
Set the size and location based on the radio button selections. Create a new Ad object, passing in the required data values to the constructor. After the Ad object has been created, call the Ad object’s calculate method to obtain the final price. Display the final price with appropriate formatting.
Step 7 – Finish up:
Be sure to add the code for the Clear and Exit buttons.
Step 8: Save and run
Save all files, then start the application. Figures 2 and 3 show sample runs of this program demonstrating the restrictions.