Presentation is loading. Please wait.

Presentation is loading. Please wait.

Problem Create a Windows-based application that will calculate the Gross Pay earned for a worker, given the number of hours worked and hourly pay rate.

Similar presentations


Presentation on theme: "Problem Create a Windows-based application that will calculate the Gross Pay earned for a worker, given the number of hours worked and hourly pay rate."— Presentation transcript:

1

2 Problem Create a Windows-based application that will calculate the Gross Pay earned for a worker, given the number of hours worked and hourly pay rate.

3 Problem Solving Input (controls): Hours Worked Hourly Pay Rate Process (event handling): Calculate Gross Pay Gross Pay = hoursWorked * hourlyPayRate Output (controls): Gross Pay

4 Creating the Visual Basic Application Event Driven Programming Create the Interface / Window first Input Output Then Code the Application Process Event Handing Methods

5 Creating the Interface Input Hours Worked  Textbox, Label Hourly Pay Rate  Textbox, Label Output Gross Pay Earned  Label (title), Label (display info) Events Calculate Gross Pay  Button Exit Program  Button

6 Design the Interface – TOE Chart Task (T)Object (O)Event (E) Input Hours WorkedTextbox, LabelNone Input Pay RateTextbox, LabelNone Output Gross PayLabel (display), Label (title) None Calculate Gross PayButtonClick Exit ProgramButtonClick

7 Create Your Interface Label Text Box Label 2 Buttons

8 Properties Form1 Name = frmWageCalculator Text = “Wage Calculator” Label1 No Need to Rename (Display Only – will not use) Text = “Number of Hours Worked” Label2 No Need to Rename (Display Only) Text = “Hourly Pay Rate” Label3 No Need to Rename (Display Only) Text = “Gross Pay Earned”

9 Properties Textbox1 Name: txtHoursWorked Text: Textbox2 Name: txtPayRate Text: Label4 Name: lblGrossPay (needs name because will will use this label) Text: Autosize: Off BorderStyle: FixedSingle Button1 Name: btnCalculate Text: “&Calculate Gross Pay” Button2 Name: btnExit Text: “E&xit”

10 Process – Event Handling btnCalculate Button Click Event Assignment statement Gets the data from the text field of the txtHoursWorked textbox and the txtPayRate textbox. Assign the calculation data from the textboxes into the lblGrossPay text field Val changes the text input from the text box into a number

11 Event Handling btnExit Button Click Event End

12 Run & Test Program Syntax Errors – Language Errors Caught by the Compiler & Interpreter Visual Basic – wavy line under problem code Run-Time Errors Causes Program to Crash Logic Errors Program Runs but gets “Wrong Answer”

13 Run & Test Program Must test for expected and unexpected input

14 Homework Create a “Multiplication Tables” application. The program should allow the user to input 2 numbers and then display the product of those 2 numbers. (Remember to use the val function)


Download ppt "Problem Create a Windows-based application that will calculate the Gross Pay earned for a worker, given the number of hours worked and hourly pay rate."

Similar presentations


Ads by Google