| | |
**i Need Help Fast**
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2005
Posts: 15
Reputation:
Solved Threads: 0
Hello, im new to this forum. I have an assignment for class that I am really confused with, please can you guys take a look and help me with the code or point me in the right direction, I am not asking anyone to do it for me...I ofcoarse wouldn't mind that
but here's the assignment:
Objective: To practice using iteration and selection constructs in Java, and writing a class.
Write a class RabbitPopulation that simulates the growth of a rabbit population. The rules are as follows:
1. Start with one pair of rabbits (i.e., one male and one female)
2. Rabbits are able to mate at the age of one month. A month later, the female produces a pair of rabbits (one male, one female).
3. Assume that a female rabbit always produces a pair of rabbits every month from the second month on.
4. Assume that rabbits never die of old age.
5. Implement a method waitAMonth that updates the population as if one month passed.
6. Implement a method hunt that updates the population as if hunters killed 10 percent of the pairs (both immature and mature).
7. Implement a method getPairs that prints the current number of rabbit pairs.
8. Write a test program that shows the growth of the rabbit population for ten months in two situations:
in the case that no hunting occurs
in the case that hunting occurs once each month.
Hint: Keep one instance field for the newborn rabbit pairs and another one for the rabbit pairs that are at least one month old.
Thank you so much for taking the time to read it and helping me out...any help would be appreciated!
but here's the assignment: Objective: To practice using iteration and selection constructs in Java, and writing a class.
Write a class RabbitPopulation that simulates the growth of a rabbit population. The rules are as follows:
1. Start with one pair of rabbits (i.e., one male and one female)
2. Rabbits are able to mate at the age of one month. A month later, the female produces a pair of rabbits (one male, one female).
3. Assume that a female rabbit always produces a pair of rabbits every month from the second month on.
4. Assume that rabbits never die of old age.
5. Implement a method waitAMonth that updates the population as if one month passed.
6. Implement a method hunt that updates the population as if hunters killed 10 percent of the pairs (both immature and mature).
7. Implement a method getPairs that prints the current number of rabbit pairs.
8. Write a test program that shows the growth of the rabbit population for ten months in two situations:
in the case that no hunting occurs
in the case that hunting occurs once each month.
Hint: Keep one instance field for the newborn rabbit pairs and another one for the rabbit pairs that are at least one month old.
Thank you so much for taking the time to read it and helping me out...any help would be appreciated!
•
•
Join Date: Aug 2005
Posts: 216
Reputation:
Solved Threads: 8
•
•
•
•
Originally Posted by hatch101
omg can u read?? didnt i say in there that im not asking u to do it for me.... :mad:
Or you can wait until either freesoft 2000 or NPL see this thread, do your work for you and then try and get you to purchase stuff from them.
Regards,
Nate
•
•
Join Date: Oct 2005
Posts: 15
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by hooknc
I think what jwenting was trying to say is... Give your best shot at your program and then ask for help on specific parts of your program.
Or you can wait until either freesoft 2000 or NPL see this thread, do your work for you and then try and get you to purchase stuff from them.
Regards,
Nate
•
•
Join Date: Aug 2005
Posts: 216
Reputation:
Solved Threads: 8
•
•
•
•
Originally Posted by hatch101
r all u guys on here super java geniuses or just ppl lookin to bash on noobs!
Some others do it for acceptance. Others do it to try and make a buck in the long run.
But not me. I'm different.
I do it to stroke my ego.
•
•
Join Date: Aug 2005
Posts: 76
Reputation:
Solved Threads: 1
Money....? Sounds good.
I'll write this for you if you want to become my client. Looking forward to working with you!
I'll write this for you if you want to become my client. Looking forward to working with you!
•
•
Join Date: Oct 2005
Posts: 15
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by server_crash
It's obvious you want your homework done for you.
Have you even tried yet? I haven't seen any work..
Here is what I have so far:
Any help would be apreciated, u can see my assignment in the first post!
I would like to know what I would have to do next so far i was able to understand it!
public class RabbitPopulation
{
private int rabbits;
private int rabbitChild;
public int adultRabbits;
public int babyRabbits;
public RabbitPopulation()
{
rabbits = 1;
rabbitChild = 0;
adultRabbits = rabbits;
babyRabbits = rabbitChild;
}
public int waitAMonth()
{
int couple = adultRabbits;
adultRabbits = adultRabbits + babyRabbits;
babyRabbits = couple;
rabbits = adultRabbits;
return rabbits;
}
public int getPairs()
{
return rabbits;
}
![]() |
Similar Threads
- Music plays too fast on Win2000 (Windows NT / 2000 / XP)
- Get Fast Access to System Settings (Windows tips 'n' tweaks)
- PHP 5 fast&easy web development (PHP)
- Fast User Switching (Windows tips 'n' tweaks)
- Slow Boot, Fast System (Windows NT / 2000 / XP)
- AGP fast write (Monitors, Displays and Video Cards)
Other Threads in the Java Forum
- Previous Thread: Display image for background
- Next Thread: java communications.
| Thread Tools | Search this Thread |
-xlint android api applet application array arrays automation bi binary blackberry block bluetooth chat class classes client code compile compiler component database developmenthelp draw eclipse error event exception fractal freeze game gameprogramming givemetehcodez graphics gui html ide image input integer j2me j2seprojects java javac javaprojects jetbrains jni jpanel jtable julia learningresources lego linux list login loop loops mac map method methods mobile netbeans newbie notdisplaying number online oracle page print problem program programming project qt recursion scanner screen server set singleton size sms sort sql string swing system template textfields threads time title tree tutorial-sample update variablebinding windows working xor






