Permalink
Browse files

Zooro boogs found

  • Loading branch information...
1 parent 3378810 commit 9fdc9b75ef58debf9f1c47ade43d0eb758df4f5a @shabda shabda committed Feb 6, 2011
Showing with 14 additions and 5 deletions.
  1. +8 −1 res/layout/main.xml
  2. +6 −4 src/com/agiliq/taxcalc/TaxCalculator.java
View
@@ -96,8 +96,15 @@
</EditText>
-
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/taxBot"
+ android:text="Tac not calculated"
+ />
<Button android:onClick="onClick" android:text="@string/calculate_tax" android:layout_height="wrap_content" android:id="@+id/button1" android:layout_width="wrap_content"></Button>
+
+
</LinearLayout>
</ScrollView>
@@ -59,14 +59,16 @@ public void onClick(View v){
int final_tax = calculateTax(income_i, investments_i, infraInvestments_i, housingInterest_i, medicalPremium_i);
calculatedTax.setText("" + final_tax);
+ TextView taxBottom = (TextView)findViewById(R.id.taxBot);
+ taxBottom.setText(""+final_tax);
}
public int calculateTax(int income, int investments, int infraInvestments, int housingInterest, int medicalPremium){
- investments = Math.min(0, Math.max(investments, 100000));
- infraInvestments = Math.min(0, Math.max(infraInvestments, 20000));
- housingInterest = Math.min(0, Math.max(housingInterest, 15000));
- medicalPremium = Math.min(0, Math.max(housingInterest, 35000));
+ investments = Math.max(0, Math.min(investments, 100000));
+ infraInvestments = Math.max(0, Math.min(infraInvestments, 20000));
+ housingInterest = Math.max(0, Math.min(housingInterest, 15000));
+ medicalPremium = Math.max(0, Math.min(medicalPremium, 35000));
int taxableIncome = income - (investments+infraInvestments+housingInterest+medicalPremium);
return (int)getTax(taxableIncome);

0 comments on commit 9fdc9b7

Please sign in to comment.