Unformatted text preview: Woody Stationery Store – Homework 2 In this homework assignment, you will develop an application that manages in‐stock quantities of items sold by Woody Stationery Store. Although this homework is designed to give you hands‐on experience on the topics discussed in Chapter 3, in order to complete this assignment successfully, you need to understand concepts and technical skills introduced in Chapter 1 through Chapter 3. Setting up Your Project: 1. Download the file HW2‐Variables‐student.zip from Blackboard to a folder in your computer. 2. Uncompress the downloaded file into a directory. a. You should be able to see in the directory a solution file HW2‐0101‐Hello‐World and a folder HW2‐0101‐Hello‐World. 3. Open the solution HW2‐0101‐Hello‐World by double‐clicking the solution file HW2‐0101‐Hello‐
World in the folder. (Microsoft Visual Basic 2010 Express or Visual Studio will start automatically.) a. In Solution Explorer, change the Project File property value i. From: HW2‐0101‐Hello‐World.vbproj ii. To: HW2‐Section‐YourFirstName‐YourLastName.vbproj iii. For example, if you are in section 0101 and your first name is Peng and last name is Huang, the project name will be HW2‐0101‐Peng‐Huang b. Double‐click HW2.vb in Solution Explorer to load Form Designer on your screen. Basic form is already designed for you and you will modify the design for this homework assignment. 4. Click the Save All menu item under File menu. Close Visual Studio and then verify that you can reopen the saved project by double clicking the solution file in the HW2‐Variables‐student folder. Application Requirements: 1. Form Design ‐ Design a form similar to Figure 1. (Max: +3pts) o For the controls whose names and types are explicitly given in Figure 1, you must use the exact names and types for the controls. However, you may notice in the figure that there are controls without names. ‐‐ e.g., the three labels in the top rows of the table layout panel. You should name such controls reasonably. Also, note that you can identify the type of each control from its name and also from its shape in Figure 1. o You will use 5x4 table to place item name, picture, the text boxes to get quantity input, and the “Add to Inventory” buttons. The top row is for the column headings. BMGT302 Homework 2 1 o o o o
o Make a label size to fill a cell by changing the Anchor property in the property window. Initially, a label is anchored to top and left. Choose also Right and Bottom, then you will see the label size is adjusted automatically. Because you start from the pre‐designed form, you only need to do this for the label with the text “Quantity to Add”, which is the heading for the third column of the table, and 4 “Add to Inventory” buttons. Also, adjust the text align property value to MiddleCenter for each label in the table. Again, you need to do this for the label with the text “Quatity to Add”, and 4 “Add to Inventory” buttons. Make the title label (“Woody Stationery Store (Inventory Management)”) to be displayed in the middle. After selecting the title label, use a “Center in Form” submenu under the “Format” menu to do this. Text alignment property for the quantity text boxes should be set to Right‐Align. The calcTotalInventoryValueButton button is associated with the access key “Alt+c” Figure 1 ‐ Form Design BMGT302 Homework 2 2 2. Adjust Tab Order. (‐2pts) Tab order should be identical to the order displayed in Figure 2. Remove unnecessary controls in your form, if there exists. For detailed information on removing unnecessary controls, see the homework #1 description. 3. Adjust the form start Location. (‐1pts) The form starting position must be Screen Center. That is, when your application starts, the form must be displayed at the center of the computer screen. 4. Write proper project information in your code. (‐3pts) In the code editor, add following comments at the top of the HW2.vb code – i.e. before the line ‘Public Class HW2’. ‘Project: Homework 2 ‘Written by: Your full name ‘Date: today’s date Figure 2 ‐ Tab Order BMGT302 Homework 2 3 5. Option statements in the General Declaration Section. (‐5pts) Write the following statements in the General Declaration Section of HW2.vb file. Option Explicit On Option Infer Off Option Strict On 6. Declare 4 class‐level named constants for item prices. (Max: +1pt) o Use meaningful variable names, and follow the naming rules for constants. o Table 1 shows the price of the 4 items. Declare 4 class‐level named constants where each constant is initialized to the price of each item. o The data type for each named constant must be Decimal. o Use meaningful name for each named constant. Item: Paper box ‐ price: 48.99D
Item: Binder ‐ price: 13.59D Item: Pen ‐ price: 34.99D Item: WhiteBoard ‐ price: 229.99D Table 1 – Item prices 7. Declare 4 class‐level variables that retain the quantities of 4 items. (Max: +1pt) o The application will retain the in‐stock quantity of each item. Declare 4 class‐level variables where each variable retains the current in‐stock quantity of individual item. o Use meaningful name for each variable. o The variables must be Integer data type and be initialized to 100. 8. At form load, initialize the text for 4 quantity text boxes, and initialize the state of controls in the form as displayed in Figure 1. (Max: +3pts) o In Lab 2, you learned how to create the procedure that will be automatically executed when the form is load. You will change the procedure (HW2_Load) to accomplish this task. o The 4 text boxes to get user input for the quantity changes should display 0 initially, and the topmost text box should be focused. o When you start the application, (1) display the picture of paper box in the large picture box in the right side of the form, and also (2) display the detailed information on the paper box in the text boxes on the right side of the form. You may reuse the statements you wrote for the task 9 to do this. (3) As you see in Figure 1, except for the text box to get quantity input for paper box and the “Add to Inventory” button right beside the text box, the text boxes to get quantity input for other items and corresponding “Add to BMGT302 Homework 2 4 Inventory” buttons should be disabled. (To disable a button or text boxes, you can change the Enabled property of a button in your code.) 9. 10. 11. 12. At an item image click, display the price and the current quantity of the selected item, and the inventory value of the item. (Max: + 3pts) o The application provided to you already displays the detailed item information at user’s click on each item image. However, it does not display the price, the current in‐stock quantity and the inventory value of the item. After you design the form, write proper statements to display the missing information in the text boxes. o The price and the inventory value should be displayed in the currency format – i.e., with dollar sign at first, and with two decimal places. See the page 177 in your textbook for further information. o Use a simple arithmetic expression to calculate the inventory value of the selected item. o Enable the text box to get quantity information of the selected item and also the “Add to Inventory” button beside the text box. Again, the other three text boxes for quantity input and “Add to Inventory” buttons must be disabled. Update current in‐stock quantity and inventory value of an item, at “Add to Inventory” button click. (Max: +5pts, Pseudo‐Credit) o When user clicks the “Add to Inventory” button after entering a number in the text box to get the quantity to add (or delete, with negative number) for the selected item, update the current in‐stock quantity of the item by considering the input value typed in the quantity text box. o The information in qtyInStockTextBox and inventoryValueTextBox should be updated accordingly. o Clear the text in totalInventoryValueTextBox. o For the pseudo‐code credit, you do not need to repeat writing the pseudo code for all 4 buttons. Just write the pseudo code for one “Add to Inventory” button. Display the total inventory value of all items at calcTotalInventoryValueButton click. (Max: + 3pts) o When user clicks the “Compute Total Inventory Value” button, calculate the total inventory value of all items and display the amount in totalInventoryValueTextBox using the currency format. o Move the focus to paperQtyTextBox. Clicking exit button should close your application. (Max: +1pt) BMGT302 Homework 2 5 After You Completed: 1. Before you close your project, save everything first. (Click the Save All menu item or the Save All icon) 2. Close Visual Basic 2010 Express or Visual Studio. (Click the Exit menu item under File menu.) 3. Using Windows File Explorer, locate the folder that contains the solution file and a directory for your project. a. Compress the folder with the name “HW2‐Section‐YourFirstName‐YourLastName.zip”. (If you submit using other compression format, you will lose 2pt.) b. Submit the compressed file via BlackBoard before the due. Grading Guideline for Homework 2: (Max. 20pts) 1. Late or incomplete submission a. Late submission penalty – see the course syllabus b. Incomplete submission (e.g., missing files) – you have to resubmit. Late submission penalty may apply. You can resubmit only within 24 hours after the due. 2. General project setting and application execution a. Application cannot be started due to compilation errors. (‐5pts) b. Abnormal termination with an error during test (‐5pts) c. Submission in non‐zip format (‐2pts) d. Incorrect tab order (‐2pts) e. Incorrect form start location (‐1pts) f. Incorrect project information at the top of your code (‐3pts) g. Incorrect Option statement setting (‐5pts) 3. Application Requirements (Max: +20pts). a. Form design b. Functionalities 4. Pseudo‐code credits (Max: +3 make‐up pts) a. If you write pseudo‐code in the source code for all requirements indicated with “pseudo‐code credits”, you can earn up to 3 make‐up points in total. Note that, the total score cannot exceed 20 points. b. Put your pseudo‐code in comments. BMGT302 Homework 2 6 ...
View Full Document
- Spring '12
- text boxes, inventory value, current in‐stock quantity