Cis 115 Week 3 Exercise Solution

869 words 4 pages
Week 3 Activity—Calculate Overtime Pay
TCO 3—Given a simple problem, design and desk-check a solution algorithm requiring a modular design that is expressed in terms of pseudocode or program notes, input-process-output (IPO) analysis, and flow chart.
TCO 4—Given a simple problem that requires one or more decisions, create a working solution that uses decisions with logical and relational expressions.
TCO 8—Given a more complex problem, develop a complete solution that includes a comprehensive statement of the problem, complete program design, and program documentation.
…show more content…

Use the same valid variable names you used in Step 1.

Note: Students may use multiple If statements instead of Select Case
Note: Students may use multiple If statements instead of Select Case

4) Pseudocode
Describe your solution using pseudocode. Use the same valid variable names you selected in Step 1.

Start Declare Constant MARRIED_RATE .15 Declare Constant SINGLE_RATE .22 Declare Constant WIDOWED_RATE .13 Declare Constant DIVORCED_RATE .23

Input hourlyRate Input hoursWorked Input maritalStatus

Select Case maritalStatus Case ‘M’ taxRate = MARRIED_RATE Case ‘S’ taxRate = SINGLE_RATE Case ‘W’ taxRate = WIDOWED_RATE Case ‘D’ taxRate = DIVORCED_RATE End Select If hoursWorked <= 40 grossPay = hoursWorked * hourlyRate Else regularPay = 40 * hourlyRate overtimePay = (hoursWorked-40) * (hourlyRate * 1.5) grossPay = regularPay + overtimePay Output regularPay Output overtimePay End IF taxAmount = grossPay * taxRate netPay = grossPay – taxAmount

Output grossPay Output netPay

5) Visual Basic Code
Screenshot of Running Program
Zipped Project File (submitted to DropBox)

Copy/paste your Visual Basic code here.

Sub Main() Const MARRIED_RATE As Decimal = 0.15 Const SINGLE_RATE As Decimal = 0.22 Const WIDOWED_RATE As Decimal = 0.13 Const DIVORCED_RATE As Decimal = 0.23



  • Comprehensive 1
    18440 words | 74 pages