Results 1 to 4 of 4
  1. #1
    roxannejane is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Exclamation Need Help for this Problem Please

    im new to java
    Last edited by roxannejane; 01-23-2010 at 05:53 AM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by roxannejane View Post
    im new to java
    This is fine since we all have to start from somewhere.

    PROBLEM #1


    a.) Create a class named Household that includes data fields for the number of
    occupants and the annual income, as well as methods named setOccupants(),
    setIncome(), getOccupants(), and getIncome() that set and return those values
    respectively. Additionally, create a constructor that requires no arguments and
    automatically sets the occupants field to 1 and the income field to 0. Save this
    file as Household.java.

    b.) Create a program named TestHousehold that demonstrate that each of the
    methods works correctly.

    c.) Create an additional overloaded constructor for the Household class you
    created. This constructor receives an integer argument and assigns the value to
    the occupants field. Add any needed statement to TestHousehold to ensure that
    the overloaded constructor works correctly.

    d.) Create a third overloaded constructor for the Household class you created.
    This constructor receives two arguments, the values of which are assigned to the
    occupants and income fields, respectively. Alter the TestHousehold program to
    demonstrate that each version of the constructor works properly.
    but do you really think that this gives you an excuse to just dump your entire assignment here without showing that you've done a lick of work?

    You know of course that all of the folks here are volunteers who enjoy helping others learn Java, and we'll gladly help you with your code or with specific questions on how you can create a certain program. On the other hand, what this forum isn't is a code-producing mill that gives out code on demand.

    So on that note, let's see a decent try by you towards a solution first. After you've done this and posted it with your specific questions, I'm sure that several of us will be be glad to help you along.

    Best of luck!

  3. #3
    roxannejane is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default

    sorry for that . yep my mistake.
    its really an assignment and its our first class.
    and i dont really know where to start. so i tried posting here, not meant to be rude. just want someone who could help.

    thanks and sory

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by roxannejane View Post
    sorry for that . yep my mistake.
    its really an assignment and its our first class.
    and i dont really know where to start. so i tried posting here, not meant to be rude. just want someone who could help.

    thanks and sory
    Please look here as it may help: Starting Writing a Program

    Then have a look at your notes and give your assignment a try yourself -- you'll always learn more that way. Then by all means come on back with your code if you still are having problems.

    Luck.

Similar Threads

  1. simple line problem / for loop problem
    By helpisontheway in forum New To Java
    Replies: 1
    Last Post: 11-17-2009, 06:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •