Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

Thread: Help with java decision structure program

1. Help with java decision structure program

think I have a grasp on all the concepts. I think another pair of eyes would be beneficial. TIA!

Problem A: Aruba Taxes. Objectives: Using Decision Structures and appropriate testing.
The taxes in Aruba are based on annual income with the following formula. For incomes of 10,000 guilders or less, the taxes = income * .02. For incomes more than 10,000 but less than 25,000, citizens pay 2% on the first 10,000 and 3% on the rest. For incomes \$25,000 but less than \$75,000 citizens pay 3% on the first 25,000 and 4% on the rest. For incomes \$75,000 or more, citizens pay 5% on all earnings. For example, the taxes on an income of \$12,000 guilders would be: \$260. Non-resident citizens get a 1% discount on the amount of taxes owed.
Create a class that represents an Aruba citizen with attributes for name, income, and residency status (use a boolean variable for this last attribute). In addition to the gets and sets for each attribute, make a constructor that accepts the name, income, and residency status when creating the object and a method that returns the amount of taxes owed. Create a driver program that will read in annual incomes, create an object representing the citizen, and print out the tax amount owed.
Use the following data for the execution you turn in:
Francisco deMiranda: \$35,000, resident
Alonso deOjeda: \$63,000, resident
Prince Stuyvesant: \$255,250, resident
Queen Beatrix: \$105,000, non-resident

This is what I have so far:
```public class ArubaTaxes
{
private String name; // Your name
private double income; // Your income
private boolean residency; //Do you live here or not?

public void setName(String n)
{
name = n;
}

public void setIncome(double ic)
{
income = ic;
}

public void setResidency(boolean res)
{
residency = res;
}

public String getName(String name)
{
return name;
}

public double getIncome(double income)
{
double taxes;

if (income < 10000)
taxes = income * .02;
else if (income > 10000 && income < 25000)
taxes = (income * .03) - (income * .02);
else if (income > 25000 && income < 75000)
taxes = (income * .04) - (income * .03);
else if (income > 75000)
taxes = income * .05;
}

public boolean residency(boolean residency)
{
boolean resident;

if (residency = false)
taxes = totalOwed * .01;
else
taxes = totalOwed;
}
}```

2. Re: Help with java decision structure program

[C0DE] [/C0DE]

3. Re: Help with java decision structure program

What exactly is the question? I don't see a specific issue or problem spelled out here.

This looks like you are trying to get people to either do or check your homework for you, which isn't really the intention of a forum.

If you do have a specific question about the code, please post a reply or update the OP and then I or another member would be quite happy to help.

P.S. We would actually be okay with checking the code for errors, if it was in code tags so that it was actually legible for a programmer to read.

4. Re: Help with java decision structure program

...

these two classes combined .try this.you can get answer.The main method you can implement as you want.
Thank you!!

5. Re: Help with java decision structure program

ravindu, read the forum rules and the following: http://www.javaprogrammingforums.com...n-feeding.html