preview

Cis 115 Week 3 Exercise Solution

Better Essays

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…

Game Seating Charges | Document | Points possible | Points received | Variable list | 4 | | IPO chart | 4 | | Flowchart | 4 | | Pseudocode | 4 | | Working program | 4 | | Total points | 20 | |

1) Variable List
List all variables you will use (use valid variable names). Indicate whether the data type is string, integer, or double, and so on.
Constant MARRIED_RATE .15 Decimal
Constant SINGLE_RATE .22 Decimal
Constant DIVORCED_RATE .23 Decimal
Constant WIDOWED_RATE .13 Decimal hourlyRate Decimal hoursWorked Decimal regularPay Decimal overtimePay Decimal maritalStatus Character grossPay Decimal taxRate Decimal taxAmount Decimal netPay Decimal

2) IPO Chart
List the inputs, any processes/calculations, and outputs. Use the same valid variable names you used in Step 1.

Inputs | Process (calculations) | Outputs | hourlyRatehoursWorkedmaritalStatus | if maritalStatus = ‘M’ taxRate = MARRIED_RATEif maritalStatus = ‘S’ taxRate = SINGLE_RATEif maritalStatus = ‘D’ taxRate = DIVORCED_RATEif maritalStatus = ‘W’ taxRate = WIDOWED_RATEIf hoursWorked <= 40 grossPay = hoursWorked * hourlyRateElse regularPay = (40 * hourlyRate) overtimePay = ((hoursWorked-40) * (hourlyRate * 1.5)) grossPay = regularPay + overtimePaytaxAmount = grossPay * taxRatenetPay = grossPay - taxAmount | If hoursWorked <= 40 grossPay netPayElse

Get Access