Home Work 2: Program Looping and Decision Statements
- (Project 4) Write a program that reads 3 integers, arranges them
in the ascending order and displays the result.
Although one can write the code in many different ways, the programs
with less computation complexity and storage requirements will be
given the highest credit.
- (Project 5) Can you use the same algorithm you have used in your
program if you were to sort 100 integers instead of 3? If yes,
show how? If no write the midified program.
- (Project 6) Write a program in C that reads the present
salary of each employee (assume a maximum of 3 employees) and
computes their future salaries over the next 10-years for a raise of
2%, 4%, 6%, 8% and 10%.
- (Project 7) Write a program that works like a calculator. The program
should allow for addition, subtraction, multiplication, division and
computing the %.
- (Project 8) Develop a program to read in a value of taxable income and
calculate the tax. The following is the tax table from the old 1987
IRS Form 1040 for married tax payers filing jointly, or for heads of
households. The newer ones have fewer steps, but because this table
has more steps, it makes for a more interesting problem.
|
Taxable | Tax | Base |
|
Income | Rate | Tax |
| $0 | 11.00% | $0 |
|
$3,000 | 15.00% | $330 |
|
$28,000 | 28.00% | $4,080 |
|
$45,000 | 35.00% | $8,840 |
|
$90,000 | 38.50% | $24,590 |
This works as follows. For example, if you have more than $3,000 in
taxable income, but less thatn $28,000, pay $330 plus 15% of the
amount in excess of $3,000.
Hint: You may use a series of if statements or the switch
statement.
This document was generated using the LaTeX2HTML translator Version 96.1 (Feb 5, 1996) Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html -split 0 -html_version 3.0 hw2.tex.
The translation was initiated by Vijay & on Thu Feb 12 11:04:46 EST 1998
Vijay &
Thu Feb 12 11:04:46 EST 1998