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 ExponentCalculator 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 ( )
CalculateAnswer Method Pseudocode +Numeric CalculateAnswer( )
Declare Variables numeric count numeric Answer
count= 1 answer= 1 while count < exponent Answer=Answer*Base count= count+1 endwhile Return (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) Answer=ExponentCalculator.CalculateAnswer( ) Display Answer Stop 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 listbox 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): Screen shot of Windows form Screen shot of class code Screen shot of button_click event code For Part B (Average Grade Calculator) Screen shot of Windows form Screen shot of button_click event code 40 Category Points % Part A: Exponent Calculator Create a form and rename it. 2 5% Add the class ExponentCalculator. 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% Part B: Grade Calculator 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 are in need of 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 the Solution Explorer and rename Form1 to frmLab5YourFirstLastName.vb. L A B S T E P S PART A: Exponent Calculator STEP 4 Pull down the Project menu, select Add Class, and add a new class to your solution named ExponentCalculator. 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 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 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 txtBase Textbox2 Name txtExponent Button1 Text Calculate The Answer Label3 Name lblDisplay lblDisplay (was Label3) Text Your Answer Will Display Here 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 in 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 exit 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 Add a new Windows Form to your Solution Explorer by pulling down the Project menu and selecting Add Windows Form. Name the form frmGradeCalculator, and click the Add button. 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 listbox 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 frmGradeCalculator Text Average Grade Calculator Label1 Text Enter Number of Grades Textbox1 Name txtNumGrades Button1 Text Get Grades and Calculate Average 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 listbox. 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.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.