27.07.2015 Views

COMP 122 Lab 2 Lab Report and Source Code (Devry) / comp122dotcom

For more course tutorials visit www.comp122.com COMP 122 Week 2 iLab Complete the following two programs: Programming Problem 1 Write a program that calculates and outputs the monthly paycheck information for an employee, including all the amounts deducted from an employee’s gross pay, and the net pay that is due to the employee. The user of your program will know the employee’s name and the gross pay for the employee. Each employee has the following deductions taken from his gross pay: Federal Income Tax: 15% State Tax: 3.5% Social Security + Medicare Tax: 8.5% Health Insurance $75

For more course tutorials visit
www.comp122.com
COMP 122
Week 2 iLab
Complete the following two programs:
Programming Problem 1
Write a program that calculates and outputs the monthly paycheck information for an employee, including all the amounts deducted from an employee’s gross pay, and the net pay that is due to the employee. The user of your program will know the employee’s name and the gross pay for the employee. Each employee has the following deductions taken from his gross pay:
Federal Income Tax: 15%
State Tax: 3.5%
Social Security + Medicare Tax: 8.5%
Health Insurance $75

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>COMP</strong> <strong>122</strong> <strong>Lab</strong> 2 <strong>Lab</strong> <strong>Report</strong> <strong>and</strong> <strong>Source</strong> <strong>Code</strong> (<strong>Devry</strong>)<br />

Click Here to Buy the Tutorial<br />

http://www.comp<strong>122</strong>.com/product-28-<strong>COMP</strong>-<strong>122</strong>-<strong>Lab</strong>-2-<strong>Lab</strong>-<strong>Report</strong>-<strong>and</strong>-<br />

<strong>Source</strong>-<strong>Code</strong><br />

<strong>COMP</strong> <strong>122</strong><br />

Week 2 i<strong>Lab</strong><br />

Complete the following two programs:<br />

Programming Problem 1<br />

For more course tutorials visit<br />

www.comp<strong>122</strong><br />

comp<strong>122</strong>.com<br />

Write a program that calculates <strong>and</strong> outputs the monthly paycheck information for an<br />

employee, including all the amounts deducted from an employee’s gross pay, <strong>and</strong> the net pay<br />

that is due to the employee. The user of your program will know the employee’s name <strong>and</strong><br />

the gross pay for the employee. Each employee has the following deductions taken from his<br />

gross pay:<br />

Federal Income Tax: 15%<br />

State Tax: 3.5%<br />

Social Security + Medicare Tax: 8.5%<br />

Health Insurance $75<br />

The output from your program should be structured as is displayed below:<br />

Bill Robinson<br />

Gross Amount: ............ $3575.00<br />

Federal Tax: ............. $ 536.25<br />

State Tax: ............... $ 125.13<br />

Social Sec / Medicare: ... $ 303.88<br />

Health Insurance: ........ $ 75.00<br />

Net Pay: ................. $2534.75<br />

Your program should deal with erroneous input values. Gross salary should always be a<br />

positive number. Make sure that you deal with the possibility that the user may have entered


a non-numeric input value. Have your program output appropriate error messages in these<br />

cases.<br />

1. Identify the inputs <strong>and</strong> outputs of the problem.<br />

2. Identify the processing needed to convert the inputs to the outputs.<br />

3. Design an algorithm in pseudo code to solve the problem. Make sure to include steps to get<br />

each input <strong>and</strong> to report each output. Include steps to deal with error cases.<br />

4. Identify three test cases, one using a positive number, <strong>and</strong> one using a negative number,<br />

<strong>and</strong> one using incorrect input (ie. Input a letter rather than a digit for the numeric input). For<br />

each of the three test cases show what inputs you will use <strong>and</strong> what your expected outputs<br />

should be.<br />

5. Write the program to implement your algorithm. Test your program using your test cases.<br />

Programming Problem 2<br />

In a right triangle, the square of the length of one side is equal to the sum of the squares of the<br />

lengths of the other two sides. Stephanie has the integer lengths of three sides of a triangle<br />

<strong>and</strong> needs to know if it is a right triangle.<br />

Write a program to solve this problem. NOTE: The user must be allowed to input the values<br />

of the sides in ANY ORDER!<br />

1. Identify the inputs <strong>and</strong> outputs of the problem.<br />

2. Identify the processing needed to convert the inputs to the outputs.<br />

3. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get<br />

each input <strong>and</strong> to report each output.<br />

4. Identify five significant test cases including one for incorrect input (ie. Input a letter rather<br />

than a digit for the numeric input). (Think about what impact changing the order of the input<br />

values should have on your program!) For each of the five test cases show what inputs you<br />

will use <strong>and</strong> calculate what your expected outputs should be.<br />

5. Write the program to implement your algorithm. Test your program using your test cases.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!