Re: Please help!



On Oct 26, 9:34 pm, dharajsm...@xxxxxxxxx wrote:
I am a student at Axia College. I have an assignment due tonight,
that I do not have a clue how to do. I am not going into Programming,
but this class is a required class to go on to the next classes in
IT. Can someone please help.

Here is the assignment:

You are an accountant setting up a payroll system for a small firm.
Each line of the table in Appendix G (posted below) indicates an
employee's salary range and corresponding base tax amount and tax
percentage. Given a salary amount, the tax is calculated by adding the
base tax for that salary range and the product of percentage of excess
and the amount of salary over the minimum salary for that range.
· Design a program that solves this problem.
· Generate a set of input test values.
· Perform a design walkthrough to verify your design.

Appendix G:

Sequential and Selection Process Control Structure
In the following example, the second line of the table specifies that
tax due on a salary of $2000.00 is $225.00 plus 16% of excess salary
over $1500.00 (that is, 16% of $500.00). Therefore, the total tax is
$225.00 + $80.00, or $305.00.

Salary Range in Dollars Base Tax in Dollars Percentage of Excess
1 0.00-1,499.99 0.00 15 %
2 1,500.00-2,999.99 225.00 16 %
3 3,000.00-4,999.99 465.00 18 %
4 5,000.00-7,999.99 825.00 20 %
5 8,000.00-14,999.99 1425.00 25 %

A simple solution based upon a table look up follows. The solution is
written using Ada.
Obvious enhancements to this solution include ensuring the input
salary is not less than
0 and not more than 14999.99.

---
-- Tax calculation exercise
---
with Ada.Text_Io; use Ada.Text_Io;
with Ada.Float_Text_Io; use Ada.Float_Text_Io;

procedure Tax_Calc is
type Tax_Rate is record
Salary_Min : Float;
Salary_Max : Float;
Base_Tax : Float;
Excess_Rate : Float;
end record;
Tax_Table : constant array(1..5) of Tax_Rate := (
(Salary_Min => 0.0, Salary_Max => 1_499.99, Base_Tax => 0.0,
Excess_Rate => 0.15),
(Salary_Min => 1_500.00, Salary_Max => 2_999.99, Base_Tax =>
225.0, Excess_Rate => 0.16),
(Salary_Min => 3_000.00, Salary_Max => 4_999.99, Base_Tax =>
465.0, Excess_Rate => 0.18),
(Salary_Min => 5_000.00, Salary_Max => 7_999.99, Base_Tax =>
825.0, Excess_Rate => 0.20),
(Salary_Min => 8_000.00, Salary_Max => 14_999.99, Base_Tax =>
1_425.0, Excess_Rate => 0.25));
Input_Salary : Float;
Total_Tax : Float;
begin
Put("Enter the salary: ");
Get(Item => Input_Salary);
for I in Tax_Table'range loop
if Input_Salary >= Tax_Table(I).Salary_Min and
Input_Salary <= Tax_Table(I).Salary_Max then
Total_Tax := Tax_Table(I).Base_Tax + ((Input_Salary -
Tax_Table(I).Salary_Min) * Tax_Table(I).Excess_Rate);
exit;
end if;
end loop;
Put("Tax for salary of ");
Put(Item => Input_Salary, Aft => 2, Exp => 0);
Put(" is ");
Put(Item => Total_Tax, Aft => 2, Exp => 0);
New_Line;
end Tax_Calc;

Jim Rogers

.



Relevant Pages

  • Re: Please help!
    ... employee's salary range and corresponding base tax amount and tax ... base tax for that salary range and the product of percentage of excess ... to check the boundaries: one just below each boundary, ... Not run each test case through your design, again by hand, ...
    (comp.programming)
  • Re: Please help!
    ... I am not going into Programming, ... employee's salary range and corresponding base tax amount and tax ... Given a salary amount, the tax is calculated by adding the ... · Design a program that solves this problem. ...
    (comp.programming)
  • Re: Please help!
    ... I am not going into Programming, ... > employee's salary range and corresponding base tax amount and tax ... Given a salary amount, the tax is calculated by adding the ... > · Design a program that solves this problem. ...
    (comp.programming)
  • Re: [SLE] Possible to do taxes in Linux? (Canada)
    ... for tax submissions is straightforward. ... the content must be done with knowledge of the software framework as ... it's far from trivial to encode tax laws. ... knowledge of spreadsheet, database or GUI programming. ...
    (SuSE)
  • Re: Please help!
    ... )>> employee's salary range and corresponding base tax amount and tax ... Perform a design walkthrough to verify your design. ... It's called "Fundamentals of programming with algorithms ... Where do you see that in the assignment? ...
    (comp.programming)