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, and fields
- Students will implement the sequence repetition structure
- 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, and operators
This lab covers the material in Chapter 3. The purpose of this lab is to demonstrate the use of TextBox controls for input, the use of constants, declaration of variables and fields, arithmetic calculations, conversion of data using the Parse and ToString methods, accumulation, counting, simple exception handling, and more GUI details.
1. Complete Programming Problem #14, Stadium Seating, on page 199 of the textbook. A revised form (original form provided in Figure 3-49) is provided below based upon the Additional Requirements. Data is also provided to test the application.
The ADDITIONAL REQUIREMENTS described below MUST also be implemented:
- Apply the currency format string for displaying monetary output (i.e., displays a leading currency symbol, digits, comma separators, and a decimal point)
- Apply the number format string for displaying non-monetary output with no decimal places (i.e., the precision must be specified)
- Implement simple exception handling to catch any exceptions that are thrown and display the exception’s default error message
- Implement named constants where applicable (i.e., the cost of the different classes of seats)
- Calculate the total tickets sold for each individual transaction
- Implement the following fields:
- Sum of revenue which accumulates the overall revenue (i.e., running sum of the Total Revenue)
- Sum of Tickets which accumulates the total tickets (i.e., running sum of the Total Tickets)
- Count of Transactions which counts the number of times the Calculate Revenue button is clicked (i.e., adding to the Count of Transactions)
- Add the following Label controls to the form (Note: GroupBox controls are used to group the various TextBox and Label controls):
- Total Tickets (descriptive and output)
- Sum of Revenue (descriptive and output)
- Sum of Tickets (descriptive and output)
- Transactions (descriptive and output)
The program MUST also include standard features of a Windows application including:
- Change the default Text property of the form to something descriptive
- Appropriate naming conventions for all controls (i.e., buttons, labels, text boxes). The required naming convention is descriptive name including control type using camelCase notation. For example: classATicketsTextBox, totalTicketsLabel, exitButton. The exception is controls not referenced in the code-behind of the Form1. For example, Label controls used for descriptive purposes only or PictureBox controls used for aesthetic purposes only.
- Button(s) with standard keyboard access key(s)
- AcceptButton and CancelButton properties should be assigned to the Calculate and Clear buttons, respectively
- Ensure tab order for form is logical (i.e., check the Tab Order)
- When Clear button is clicked the controls in the Tickets Sold and Revenue Generated GroupBoxes should be cleared and the focus set to the appropriate text box for the program (i.e., typically the first input value). Do NOT clear the controls in the Summary GroupBox. Do NOT reset the values of the fields.
- Appropriate naming conventions and data type declarations for variables and named constants
- Remove all unused event handlers from the program code
2. Name your project using the naming convention provided in the syllabus: CourseNumber_LastNameFirstInitial_LabXX (e.g., 3333_SharpJ_Lab03)
3. Include the appropriate identification information per the course syllabus using comment statements above the using statements in the code-behind of Form1 (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 03 link under Assessments in the Chapter 3 Module.
6. See Revised Form based on Additional Requirements and Sample Test Data below:
|Tickets Sold||Revenue Generated (output)||Summary (output)|
|Class A: 320 (input)||Class A: $4,800.00||Sum of Revenue: $19,650.00|
|Class B: 570 (input)||Class B: $6,840.00||Sum of Tickets: 1,780|
|Class C: 890 (input)||Class C: $8,010.00||Transactions: 1|
|Total Tickets: 1,780 (output)||Total Revenue: $19,650.00|
|Class A: 500 (input)||Class A: $7,500.00||Sum of Revenue: $46,950.00|
|Class B: 750 (input)||Class B: $9,000.00||Sum of Tickets: 4,230|
|Class C: 1200 (input)||Class C: $10,800.00||Transactions: 2|
|Total Tickets: 2,450 (output)||Total Revenue: $27,300.00|
|Class A: 100 (input)||Class A: $1,500.00||Sum of Revenue: $56,550.00|
|Class B: 300 (input)||Class B: $3,600.00||Sum of Tickets: 5,130|
|Class C: 500 (input)||Class C: $4,500.00||Transactions: 3|
|Total Tickets: 900 (output)||Total Revenue: $9,600.00|