Form Is Invalid!

Lab 5 of 7: Exponent Calculator and Average Grade Calculator (Iteration) (40 Points)
Submit your assignment to the Dropbox located on the silver tab at the top of this page.
(See Syllabus “Due Dates for Assignments & Exams” for due dates.)
L A B O V E R V I E W
Scenario and Summary
In Part A of this lab, you’ll write a VB program containing an Exponent Calculator class. The class has base and exponent properties and a CalculateAnswer method that uses a do-while loop to calculate the result of applying an exponent to a base value. You’ll also instantiate the class in a VB driver program’s click event.
Below are the Class diagram; the CalculateAnswer method’s pseudocode; and the driver-program logic for Part A, the Exponent Calculator.
ExponentCalculator +Numeric Base +Numeric Exponent +Numeric CalculateAnswer ( )
Declare Variables numeric count numeric Answer
Driver Program Click_Event Pseudocode Start Declare Variables ExponentCalculator objExponentCalculator Numeric Answer
Get Exponent, Base ‘(assign these values to the appropriate properties in the ExponentCalculator Class)
In Part B, you’ll add a second Windows form to the program that will work as a grade calculator. The user types the number of grades he or she wants to enter in the textbox. When the user presses the button, the program enters a loop that gets the specified number of grades and then totals them up. Then, the program displays the average of the grades in a list box that is formatted to two decimal places.
Deliverables
Section
Deliverable
Points
Part A, Step 10, and Part B, Step 7
Lab5YourFirstLastName.docx (Word document) For Part A (Exponent Calculator): Screenshot of Windows form Screenshot of class code Screenshot of button_click event code For Part B (Average Grade Calculator) Screenshot of Windows form Screenshot of button_click event code
40
Category
Points
%
Part A: Exponent Calculator
Create a form and rename it.
2
5%
3
7.5%
Enter the public properties and methods.
6
15%
Add controls to the form and set the properties.
3
7.5%
Code the button-click event.
5
12.5%
Test and run the application with test data.
3
7.5%
Create a form and rename it.
2
5%
Set the form as a startup object.
5
12.5%
Design the form interface and set its properties.
3
7.5%
Code the button-click event.
5
12.5%
Test and run the application with the test data shown.
3
7.5%
Total
40
100%
L A B S T E P S
PART A: Exponent Calculator STEP 1
Log onto the Citrix Server and launch Visual Studio 2010.
Note: This lab provides limited guidance for the steps performed in previous labs. If you need additional guidance, please refer to the prior labs.
L A B S T E P S
PART A: Exponent Calculator STEP 2
Start a new Visual Basic Windows Forms Application Project, and name it Lab5YourName.
L A B S T E P S
PART A: Exponent Calculator STEP 3
Go to Solution Explorer and rename Form1 to frmLab5YourFirstLastName.vb.
L A B S T E P S
PART A: Exponent Calculator STEP 4
L A B S T E P S
PART A: Exponent Calculator STEP 5
Add the public properties and the method to the class. Put your name at the top of the class as well as a brief description in the comments. When finished, it should look like this.
Click the Save All button on the toolbar to save your work.
L A B S T E P S
PART A: Exponent Calculator STEP 6
In the Solution Explorer, double-click the frmLab5YourFirstLastName.vb Windows form to open it. In the Design view, add controls to the form so that it looks like this.
To design this form, drag three labels, two textboxes, and a button from the Common Controls area of the Toolbox to the form, and position and size them as you did in Lab 4, Step 6.
Then, set the properties of each control in the Properties window, as follows.
Control
Property
Setting
frmLab5YourFirstLastName
Text
Lab5YourFirstLastName
Label1
Text
Enter Base
Label2
Text
Enter Exponent
Textbox1
Name
textbase
Textbox2
Name
Xt exponent
Button1
Text
Label3
Name
ll display
ll display (was Label3)
Text
L A B S T E P S
PART A: Exponent Calculator STEP 7
While the form is still in Design view, double-click on the button to bring up its button1_click event. Put the following code in it, including comments at the top that indicate the lab number and your name.
L A B S T E P S
PART A: Exponent Calculator STEP 8
Test your program for errors using the Start Debugging button. Enter 5 as the base and 3 as the exponent, and click the button. A working program should display the following.
L A B S T E P S
PART A: Exponent Calculator STEP 9
Create a new Word file called Lab5YourFirstLastName.docx and paste screenshots of your Windows form, your class code, and your button-click event code in it. Make sure that your name appears in the text property of the form as well as in the comments in the class and the driver program.
Save the Word document. You will add more screenshots to it in Part B of this lab.
L A B S T E P S
PART A: Exponent Calculator STEP 10
If you want to pause now and come back later to work on Part B of this lab, you can save your project by clicking the Save All button on the toolbar and then safely exiting from Visual Studio. If you want to continue working, simply proceed to Part B.
L A B S T E P S
PART B: Grade Calculator STEP 1
If you closed your project and exited from Visual Studio at the end of Part A, log onto the Citrix Server, launch Visual Studio, and open the Lab5YourName project that you created in Part A.
If the project appears on the Visual Studio Start Page under Recent Projects, simply click it to open it.
If you don’t see Lab5YourName in the Recent Projects list, pull down the File menu, select Open, and then select Project/Solution. In the Open Project dialog, select the Lab5YourName folder, and click Open. Then, select the Lab5YourName.sln solution file, and click Open.
L A B S T E P S
PART B: Grade Calculator STEP 2
L A B S T E P S
PART B: Grade Calculator STEP 3
Set your new Windows form as the startup object so that it displays when you press the Start Debugging button later on. Do this by pulling down the Project menu, selecting Lab5YourNameProperties, and then selecting the Startup Form drop-down list. Your new form, called frmGradeCalculator, should appear in the list. Select it.
L A B S T E P S
PART B: Grade Calculator STEP 4
Double-click the frmGradeCalculator.vb form in Solution Explorer to open it. Design the form’s interface so that it looks like the screenshot below.
To do this, drag a label control, a textbox control, a button control, and a list box control from the Toolbox onto the form, and position them approximately, as shown below.
In the Properties window, set the control properties, as listed below.
Control
Property
Setting
Text
Label1
Text
Textbox1
Name
Button1
Text
Listbox1
Name
lstOutput
L A B S T E P S
PART B: Grade Calculator STEP 5
Double-click on the button, and enter the code inside the Button1_Click event so that your screen looks like this.
L A B S T E P S
PART B: Grade Calculator STEP 6
Test the program by running it and entering the value 3 in the textbox. Supply some grades to the input boxes that pop up, and check that the grades you entered, the running total, and the average are displayed in the list box. Correct any errors.
For example, if you enter 100, 75, and 85 as the three grades, your form should look similar to this.
L A B S T E P S
PART B: Grade Calculator STEP 7
Paste screenshots of your frmGradeCalculator Windows form and your button-click event code in your Word document named Lab5YourFirstLastName.docx after the screenshots you created in Part A of this lab. Save the Word document file, and submit it to the Lab 5 Dropbox.