Results 1 to 4 of 4
- 01-23-2010, 04:44 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 2
- Rep Power
- 0
-
This is fine since we all have to start from somewhere.
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?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.
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!
- 01-23-2010, 05:31 AM #3
Member
- Join Date
- Jan 2010
- Posts
- 2
- Rep Power
- 0
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
-
simple line problem / for loop problem
By helpisontheway in forum New To JavaReplies: 1Last Post: 11-17-2009, 06:12 AM


LinkBack URL
About LinkBacks


Bookmarks