I am working on this problem and I got a pretty good idea of what I am doing...but, I don't know if I am doing it correctly. I already worked the problem out...but, need some assistance and I'm not trying to get you to do my homework for me, just need a little help.
Write a program that displays the income tax due (in a certain state) on a taxable income entered by the user, according to the tax table shown in Table 9.2.
TaxableIncome Tax Due
From To
$0 $50,000 $0 + 5% of amount over $0
$50,000 $100,000 $2,500 + 7% of amount over $50,000
$100,000 . . . $6,000 + 9% of amount over $100,000
The program should allow the user to enter a series of incomes, terminated by 0. Use a class called Tax, with attributes Income and TaxDue and methods that include ComputeTax() and access methods (SetIncome(), GetIncome(), SetTaxDue(), and GetTaxDue()) for each of the attributes.
Program
Declare Public Class tax
Declare Public Property INCOME As Integer;
Declare Public Property TAXDUE As Float With Precision 2, Size 3;
Declare Public Method NEW(income As Integer = 0)
this.INCOME = income;
this.TAXDUE = 0.00
End Public Method NEW
Declare Public Method COMPUTETAX
If this.INCOME Is Less Than Or Equal To 50000 Then
this.TAXDUE = this.INCOME * 0.05;
Else If this.Income Is Less Than Or Equal To 100000 Then
this.TAXDUE = (this.INCOME * 0.07) + 2500;
Else
this.TAXDUE = (this.INCOME * 0.09) + 6000;
End If
End Public Method COMPUTETAX
End Public Class
BEGIN main program BEGIN
Use Class tax;
Declare input As Integer;
Declare taxtotal As Float With Precision 2, Size 3
Do
Prompt "Input a salary (enter 0 To exit): " + Line Break;
input = User Input;
Declare salary As New tax(input);
taxtotal = salary.COMPUTETAX;
Output "The tax for salary of " + input + " is " + taxtotal + Line Break;
Loop While input Is Not Equal To 0
END main program END
Thank you so much for you assistance!