This lab relates to the following Skill Outcomes:
- Students will apply the steps in the program development process
- Students will implement object-oriented programming through predefined classes
- Students will develop graphical user interface applications using appropriate controls
- Students will implement primitive data types for variables, constants, fields, and lists
- Students will select appropriate arithmetic operators
- Students will analyze, design, implement, test, and debug domain-specific applications which demonstrate basic computation, input/output, control structures, operators, input validation, and methods
This lab covers material from Chapter 7 and Appendix B as well as concepts covered in previous chapters. The purpose of this lab is to demonstrate the use of a list to store and manipulate values entered by the user as well as to implement ToolTips, a ComboBox, and a Menu System.
Create an application that keeps track of the total donuts sold, the average donuts sold, and the total of donut sales through the implementation of a List (Do NOT use an Array).
* The form should contain a menu system with the following menu items (the menu items in the Tools menu are all related to the simple combo box for the donut types):
File | Tools | Help |
Exit | Add Donut Type | About |
Remove Donut Type | ||
Clear All Donut Types | ||
Display Donut Type Count |
An example is provided below of the form and required message boxes:
Form1 | Message Box for Display Donut List Button | Message Box for About menu item (use YOUR name) |
* Use a Simple Combo Box to hold the donut types initially populated with Chocolate and Glazed. Make sure and keep the list sorted in ascending alphabetic order as donut types are added (hint: see Sort property of the Simple Combo Box).
Add Donut Type: The user should be able to add to the combo box. Do not allow a blank donut type to be added to the combo box. Display an appropriate message if this occurs. Focus should be returned to the text box portion of the combo box. This should be coded in the Add Donut Type menu item click event handler.
Remove Donut Type: The user should be able to remove a donut type from the combo box. Display an appropriate error message if the user selects Remove Donut Type without first selecting a donut type. This should be coded in the Remove Donut Type menu item click event handler.
Clear All Donut Types: The user should be able to clear all donut types from the combo box. This should be coded in the Clear All Donut Types menu item click event handler.
Display Donut Type Count: The user should also be able to display the count of donut types in the combo box. This should be coded in the Display Donut Type Count menu item click event handler.
* The About menu item under the Help menu should display Your Name in a Message Box. This should be coded in the About menu item click event handler.
* The Exit menu item under the File menu should exit the application. This should be coded in the Exit menu item click event handler.
* Implement a List of whole-numbers (no decimal places) to store the number of donuts entered by the user (Do NOT implement an Array).
* The Calculate button adds the individual number of donuts to the List, calculates the Total of Donuts Sold, Average Donuts Sold, and Total of Donut Sales. The Calculate button should then clear and set the focus to the Number of Donuts text box for the next user entry.
* The Display Donut List button should display the items in the List using a Message Box. The Number of Donuts text box should be cleared and focus set back to it for the next user entry.
* The Clear Donut List button should clear the List, as well as clear the input and output controls and set the focus to the Number ofDonuts text box. It should also set the donut type combo box back to unselected. Counters and accumulators should also be reset where appropriate. DO NOT CLEAR THE DONUT TYPE COMBO BOX.
* Include the following Data Validation and display an appropriate message (Message Box OR ErrorProvider component may be used) and clear and set the focus to the control causing the error (a nested if statement is recommended):
- Number of Donuts must be a valid data type (i.e., TryParse method)
- Number of Donuts must be greater than zero (accuracy validation)
- User must select an item from the donut type combo box (text box portion of combo box should not be blank)
* Add ToolTips to ALL the buttons with descriptive text
* ALL donut types cost .60 (assume all donut types are the same price)
The program must include standard features of a Windows application including:
- Change the Text property of the form as indicated on the sample form
- Appropriate naming conventions for all controls
- Buttons with appropriate name and keyboard access key
- AcceptButton and CancelButton properties should be assigned to the Calculate and Clear Donut List buttons respectively
- Appropriate naming conventions and data type declarations for variables
2. Name your project using the naming convention provided in the syllabus: CourseNumber_LastNameFirstInitial_LabXX (e.g., 3333_SharpJ_Lab07)
3. Include the appropriate identification information per the course syllabus using comment statments at the top of your project code (see p. 102, 2.8 Comments, Blank Lines, and Indentation): Name, 9-Digit ID, Due Date, Date Submitted, and Brief Description of Program.
4. You will need to zip/compress the project folder using an appropriate zip/compression utility such as the one found in the Windows or WinZip, etc. Please DO NOT submit .rar (archive) files.
5. Attach and submit the zipped/compressed project folder file under the Lab 07 link under Assessments in the Chapter 7 Module.