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.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Help with java decision structure program

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Thanked 0 Times in 0 Posts

    Default 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
    Halevi Maduro: $23,000, residentFransic
    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;
    taxes = totalOwed;
    Last edited by helloworld922; November 5th, 2011 at 12:22 PM.

  2. #2
    Join Date
    Mar 2011
    My Mood
    Thanked 4 Times in 4 Posts

    Default Re: Help with java decision structure program

    please place your code in tags...
    [C0DE] [/C0DE]

  3. #3
    Join Date
    Jun 2011
    My Mood
    Thanked 8 Times in 8 Posts

    Default 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. #4
    Junior Member
    Join Date
    Oct 2011
    My Mood
    Thanked 1 Time in 1 Post

    Default 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!!
    Last edited by copeg; November 5th, 2011 at 10:54 AM.

  5. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 832 Times in 772 Posts
    Blog Entries

    Default Re: Help with java decision structure program

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

Similar Threads

  1. Ordered Binary Decision Tree
    By nilay in forum Member Introductions
    Replies: 1
    Last Post: October 7th, 2011, 06:12 AM
  2. Setting up Directory Structure in Java Applications
    By Jyotirmoy in forum Member Introductions
    Replies: 0
    Last Post: July 28th, 2011, 05:28 AM
  3. Run command line structure in Java
    By soheilz92 in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: April 20th, 2011, 02:26 AM
  4. Replies: 3
    Last Post: April 16th, 2011, 01:38 PM