Bock Golf Store Lab 7

Total Page:16

File Type:pdf, Size:1020Kb

Bock Golf Store Lab 7

Bock Golf Store Lab 7

Management at the Bock Golf Store needs an application that can be used to track the value of inventory that is in stock. The application user will enter information about inventory items during physical inventory sessions. The project functionality is provided through the use of menu controls.

Requirements. Develop a form that is similar to the one shown below. You may have minor differences.

Getting Started.  Start Visual Studio.  Click the Create Project hyperlink or use the File-New Project menu option.  In the New Project dialog box type a name for the project—name the project Lab7 + YourLastName + YourFirstName– for example, if your name is Doug Bock and you are in the 12:00 class section, name the project Lab7-Bock-Doug.  Change the form’s File Name property from Form1.vb to Lab7.vb.  Click the Save All button on the button toolbar. The Save Project dialog box will display. In the Location drop-down combo box save the project to the My Documents folder.  Continue your work on the project. Periodically you should click the Save All button so you don’t lose any work.

Application Use and Special Instructions

The form will be used primarily to enter inventory information for product items stocked by the store. These products will simply be referred to in this specification as an "item." The coding requirements to support the management of inventory are explained for each coding event listed below.

Build and Code the Project

1. Design.  Use appropriate names for the controls on the form.  The itemComboBox control – set DropDownStyle = DropDown. Add the following items at design time: 1. TaylorMade R7 Driver RH 10-degree 2. TaylorMade R7 Driver LH 10-degree 3. TaylorMade R7 Driver RH 9-degree 4. Titleist 907D2 Driver RH 9.5-degree 5. Titleist 907D2 Driver RH 10.5-degree 6. King Cobra HS9 X Driver RH 9-degree 7. King Cobra HS9 X Driver LH 9-degree 8. Adams Redline RPM Driver RH 10-degree 9. Cleveland Hi Bore Driver RH 10.5-degree 10. Cleveland Hi Bore Driver LH 10.5-degree 11. Cleveland Hi Bore Driver RH 9.5-degree 12. Cleveland 460 Comp Driver RH 10.5-degree

 Quantity of Item and Wholesale Cost TextBox controls – set ReadOnly = False. These two controls are used for data input.  Total Value TextBox control – set ReadOnly = True and TabStop=False. This control will only display output.  All TextBox controls – set TextAlign = Right.  The form for the project should startup centered on the computer monitor screen.  Initial focus should be on the itemComboBox control.  The itemListBox Items (collection) property is empty on startup.

2. Menu. Add a menu to the form by using a MenuStrip control with the following menu items. Add the specified shortcut keys and separators. The function of each menu item is explained throughout the remaining requirements.

&File &Inventory &Colors and Fonts &Help E&xit &Add to Item Listing Ctrl+A Set &Background &About &Clear Item Listing Ctrl+C Color C&ount Item Listing Ctrl+O Set &Font &Print Item Listing Ctrl+P ------A&dd Item To Combo Box Ctrl+M &Delete Combo Box Item Ctrl+D

Programming Events

You must set OPTION STRICT ON. 3. File – Exit menu item. When clicked, exit the application without asking for the application user's confirmation to quit.

4. Inventory – Add to Item Listing menu item. Application users will use this menu as part of the process of entering inventory information. The steps for entering inventory information are: (1) select an existing inventory item from the Select Item ComboBox control, (2) enter the wholesale cost of the item and quantity in stock, (3) click the Inventory menu, Add to Item Listing sub menu. When this menu is clicked, your code must do the following:  Call a function named ValidData that validates the following business rules. If a business rule is violated, display an appropriate message box and do NOT process the data. o Business rule #1: An inventory item type has been selected from the itemComboBox control. o Business rule #2: The wholesaleCostTextBox control contains a numeric value greater than zero. o Business rule #3: The quantityTextBox control contains a numeric value greater than zero. If the data is valid, complete these additional computing tasks.  Calculate the Item Value (quantity times price) and store this value to a decimal variable.  Display (Add) a string consisting of the Item (from the ComboBox) + Item Value (not the wholesale cost) as a string item to the itemListBox control as illustrated in the figure of the form shown earlier.  Accumulate (Add) the Item Value to a module-level variable that will store the total inventory value of all items counted during an inventory session, and then update the display of the running total inventory value to the Total Inventory Value TextBox control at the bottom of the form. Note that an inventory counting session almost always consist of counting more than one item. Also, the same type of item may be stored in more than one location in the store so the same item may appear more than once in the itemListBox.  Clear the text property for each of the itemComboBox, wholesaleCostTextBox, and quantityTextBox controls. Unselect the itemComboBox item. Set the focus to the itemComboBox.  Items listed in the itemListBox control should NOT be sorted.

5. Inventory – Clear Item Listing menu item. In order to start a new inventory session, the application user will need to have the contents of the itemListBox cleared. When this menu is clicked:  Display a message box to ask the system user to confirm that the itemListBox control is to be cleared by using a message box with multiple buttons (Yes and No). The default button is No. If the application user clicks Yes:  Unselect the item that may be selected in the itemComboBox control.  Clear the Text property of the itemComboBox control.  Clear the Text property of all of the TextBox controls.  Clear the contents of the itemListBox control.  Set the value of the Total Value memory variable to zero (see #5 above for an explanation of this variable).  Set focus to the itemComboBox.

6. Inventory – Count Items In Listing menu item. Display a message box with a message that tells the application user how many different inventory items are available in the ComboBox control. Design an appropriate message and use an appropriate title bar entry and appropriate icon/button combinations for the message box.

7. Inventory – Print Item Listing menu item. When clicked, use a PrintPreviewDialog control to display a preview report (to save on paper). The report should have a heading line in 14 point, bold print (you pick the font name) "Inventory Items", a second heading with your name in 12 point regular, and detail lines listing all of the items from the itemListBox control in 12 point regular. The top margin should be about one inch and the output should be approximately centered on the page.

8. Inventory – Add Item To Combo Box. The application user may add a new inventory item (such as a great new Callaway driver golf club!) that is not currently listed in the ComboBox. The application user should type the new item into the Text portion of the ComboBox, then click this menu. When the menu is clicked, add the new item to the ComboBox (collection property). Do not allow blank or duplicate items. If the application user tries to add blank or duplicate items, display an appropriate error message. Items added should display in sorted order. An example of a duplicate: TaylorMade R7 Driver RH 10-degree is a duplicate of TAYLORMADE R7 DRIVER RH 10-DEGREE.

9. Inventory – Delete Combo Box Item menu item. Delete the currently selected ComboBox item (without asking for application user for confirmation to delete). If an item has not been selected, display an error message telling the application user to select an item to delete. Also clear the contents of the Text property of the ComboBox control if an item is deleted.

10 Colors and Fonts – Set Form Background Color menu item. When clicked, display a color dialog control and change the background color of the form to the selected color.

11. Colors and Fonts – Set Form Font menu item. When clicked, display a font dialog control and change the font for all controls on the form (including the menu strip) to the selected font.

12. Help – About menu item. Use a message box to display your name and the current date and time with an appropriate icon. The output should display your name on the first line and the current date/time on the second line.

13. Context menus. Add a context menu to the form that will function when you right- click anywhere on the form (except for the form's title bar).  The context menu should have three entries: Color, Font, and Exit with a separator bar between Font and Exit.  When Color is selected, use one of the techniques covered in your notes to call the existing sub procedure for the Set Form Background Color menu item.  When Font is selected, use one of the techniques covered in your notes to call the existing sub procedure for the Set Form Font menu item. 14. Regions. Organize the code by regions. You decide an appropriate organization for your program.

15. Comments. Add comments throughout the program as appropriate sufficient to describe the processing. Also add general comments at the top of the program to identify the project, your name, and date.

Other Requirements. Ensure that you follow all standards for programming that you learned and used in earlier computer programming assignments including the use of comments, proper spacing of code, proper spelling, proper indentation of code, etc., as listed in the assessment section given below.

Test the Lab. Use the assessment guidelines provided below to test your lab work. This is the same set of assessment guidelines that will be used to grade your work.  Use the test data given here for initial program testing. You will need to use additional test sets to thoroughly test the application.  Ensure you test each Try-Catch block by entering erroneous data in addition to the test data shown below.

What to Do When You’re Finished, Follow the check list below.

Before Startup – Form Design (2 points; -1 for each mistake, maximum of -2 plus any deduction for late submission).  Project should be named correctly: Lab7 + YourLastName + YourFirstName.  The form's File Name property is set to a new name (Lab7.vb, NOT Form1.vb).  Title bar of the form has the required information as shown in the figure.  Form has a good appearance with all controls aligned and sized appropriately so that the appearance is pleasing and professional. Errors include misspelled words, having too much or not enough gray space around controls, controls not aligned, TextBox controls too small to display all required information.  All output TextBox controls have the correct TextAlign, ReadOnly, and TabStop settings.  The itemComboBox has DropDownStyle = DropDown and has the required initial items stored in the Items (collection) property.  Initial focus is on the itemComboBox.  Program code has the required remarks that identify the program, programmer name, and date programmed.  OPTION STRICT ON has been coded.  Each sub procedure has remarks statements to identify what the sub procedure does.  All variables and controls are named properly following the naming convention taught in the notes and in class.  Code is organized by regions.

Before Startup – Menu (2 points; -1 for each mistake; maximum of -2).  Any missing menu item will result in a deduction for the required coding of that menu (if the menu item is missing, then the code cannot be executed even if you have written the code). Startup (2 points; -1 for each mistake; maximum of -2).  Form starts up centered on the screen. Form is an appropriate size.  Tab order is correct.

File – Exit menu item (1 point). Exits the application without asking for the application user's confirmation.

Inventory – Add to Item Listing menu item (10 points).  Calls ValidData function. Validates each business rule (-1 for each rule not validated). When data is valid:  Calculates the Item Value (quantity times price) and store this value to a decimal variable.  Display the Item (from the ComboBox) + Item Value (not the wholesale cost) to the itemListBox control formatted correctly.  Correctly updates the Total Inventory Value TextBox control.  Clears the text property for each of the itemComboBox, wholesaleCostTextBox, and quantityTextBox controls.  Unselect the itemComboBox item. Set the focus to the itemComboBox.

Inventory – Clear Item Listing menu item (3 points).  Displays a message box to confirm clearing the itemListBox.  Defaults the button to No.  Unselects the item that may be selected in the itemComboBox control.  Clears the Text property of the itemComboBox control.  Clears the Text property of all of the TextBox controls.  Clears the contents of the itemListBox control.  Sets the value of the Total Value memory variable to zero (see #5 above for an explanation of this variable).  Sets focus to the itemComboBox.

Inventory – Count Items In Listing menu item (2 points).  Displays a message box with a message that includes a count of the ComboBox items.  Message box has appropriate icon/button combination and title bar.

Inventory – Print Item Listing menu item (5 points).  Coded, but produces no output (-5).  Uses a PrintPreviewDialog control to print the report (-2).  Has both required headings with correct font size (-1 each).  Report has some error such as duplicating the heading within the loop.  Does not print all items from the itemListBox control.  Output is centered on the page with about a one-inch top margin.

Inventory – Add Item To Combo Box (7 points).  Coded, but does not add a new inventory item to the ComboBox or code ABENDS (-3).  Does not allow duplicate or blank items.  Displays appropriate message box when the user attempts a duplicate or blank add.  Handles duplicate entries regardless of the use of upper/lower case.

Inventory – Delete Combo Box Item menu item (2 points).  Coded, but doesn't delete an item from the ComboBox or ABENDS (-2).  Displays appropriate error message if an item to be deleted has not been selected.  Clears Text property of ComboBox if an item is deleted.

Colors and Fonts – Set Form Background Color menu item (1 point).  Changes the background color of the form to the selected color.

Colors and Fonts – Set Form Font menu item (1 point).  Changes the font for all form controls to the selected font.

Help – About menu item (1 point).  Displays required message box with your name and the current date and time on two separate lines.  Includes an appropriate icon.

Context menus (3 points).  Has the required context menu with Color, Font, and Exit (-3 if missing or context menu does not work).  Context Menu Item Coding – uses one of the techniques covered in your notes to call the appropriate existing sub procedures (-1 for each one not called properly).

Other Errors.  During program execution, your computer program should compile and execute without generating any error messages End of Lab

Recommended publications