472,336 Members | 1,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,336 software developers and data experts.

Urgent......need help solving java problem

i have a java prob, and i have to solve it fast, but i'm just getting to know it, so plz help me solve it with full code completed, thanks so much. the prob is to create a monter fight and there is the description:
The monsters are of a very strange kind, called "Bigmon". They have some basic characteristics, like attack and defense power, life points, a name, and a bonus factor that is used in special occasions.
In this initial phase of the project, we will need to develop 3 classes, with 3 different purposes.
1. A Bigmon class, that allows us to create instances of our virtual monsters.
2. A FightMenu class, that shows the main menu of the game, and is the starting point of the
3. A FightTest class, that has some functionality to allow us an easy way to run some automated actions in our program, to verify that our changes don't introduce errors.

Bigmon class
Our virtual monsters have some associated information:
● name
● life points: when they reach 0, the Bigmon is dead, and needs to be healed or it can not fight anymore. We also need to remember what is the maximum life points of each Bigmon monster.
● attack power: between 0 and 18.
● defense power: between 0 and 18.
● bonus: between 1 and 3, with decimals. Default value is 1.2. In special occasions, our Bigmon can have extra power for fighting. See explanation below.
Our Bigmon class must have several methods:
1. Accessors (getters) and mutators (setters) for all relevant variables.
2. Two constructors, one without parameters that creates a default Bigmon, with very average values (not too strong, not too weak); and one with parameters for name, max points, attack power and defense power.
3. Functions (methods that are not of type void) that calculate the value of an attack attempt and defense attempt, taking the bonus into account.
4. A function that returns a one line summary of the status of the Bigmon: name, life points, max points, attack power, defense power.
How Bigmons Fight
When 2 Bigmons fight, they take turns exchanging attacks. Here is the process:
● At the beginning of the fight, one Bigmon is chosen randomly to start attacking.
● The attacking Bigmon gets a random number between 0 and its attack power.
Example: if its attack power is 14, the random number is between 0 and 14.
● The defending Bigmon gets a random number between half of its defense power and its defense power.
Example: if its defense power is 16, the random number is between 8 and 16.
● If the attacking Bigmon has the higher number, the defending Bigmon loses as many life points as the difference between the numbers.
● If the defending Bigmon has the higher number, nothing happens.
● There are 2 exceptions to this general rule:
○ If the attacking Bigmon gets lucky, and his random number is the maximum he can get, he always hits. The defending Bigmon loses life points: 50% of the attack power of the attacking Bigmon. (In our example, 7 points.)
○ If the attacking Bigmon is very unlucky and gets a 0, the attack backfires! The attacking Bigmon loses life points: 50% of his own attack power!
● Now the defending Bigmon will attack, and the attacking Bigmon defends.
● The Bigmons attack each other in a loop until one of them has 0 life points.
There is a Bonus system that also changes the progress of a fight. See the explanation below.
You should notice that the Fight process is going to make you add several methods to the Bigmon class if you want to keep the code for the fight more clear. Try to avoid putting functionality that belongs to the Bigmon class in the FightMenu class.
Bonus System
When a Bigmon has only 20% of his maximum life points, he has a 30% chance of transforming into a SuperBigmon! If he gets lucky, its attack and defense power are multiplied by the bonus, until the end of the fight, and he recovers 20% of his life points. Its name is also written differently, as explained below.
Example: a Bigmon called Kapuche, with maximum life points 40, attack power 16, defense power 12, bonus 1.2. During a fight he has only 7 life points (less than 8 points, 20% of 40). At the beginning of each fight round, he can transform into "|</\puch3". If he is lucky and transforms, his attack power becomes 19 (16 * 1.2, no decimals), defense 14 (12 * 1.2), and recovers 8 life points. All this, except the life points, is back to normal at the end of the fight. A Bigmon can be very dangerous when he is almost dead!!
SuperBigmon Names
As you have seen in the example, when a Bigmon is in SuperBigmon form, his name is printed differently. We are going to use a small part of the “L33t” way of spelling, as described here:

Letter in Normal form - Letter in Super form
A - /\
a - @
e or E - 3
f or F - ph or Ph
k or K - |<
m or M - /V\
n or N - |\|
o or O - 0 (the number zero)
s or S - 5
v or V - \/
w or W - \X/
You need to be able to modify any word in the way described in the table, because we will allow the user to type any name that he/she wants for the Bigmon. We will also have a way to generate random Bigmon names.
Keep in mind that we only need to use the SuperBigmon name when the Bigmon is in “Super” form, exactly at the same time as his attack and defense power are affected by the bonus.
Hint: use the StringBuilder, to give you more flexibility replacing text.

FightTest class
The FightTest class has one main method, that does the following actions:
● Create 2 random Bigmons.
● Display their information on the screen.
● Displays their SuperBigmon names.
Only display the names! The Bigmons must be in normal form for the next step!
● Starts a fight between them.
It is important that you find a way to make the FightTest class use the fight method of the FightMenu class, and not have its own copy of the fight code!!
FightMenu class
This is the actual Game class, which starts the proper game play in our program. When you start its
main method, it will create an instance of the FightMenu class, and run a method of this instance
that prints this on the screen:
* Bigmon Battle! *********************
1. Create a new Bigmon
2. List all the Bigmons
3. Delete a Bigmon.
4. Heal a Bigmon.
5. Delete all dead Bigmons.
6. Fight! (Bigmon vs. Bigmon)
0. Exit.
Your Choice: _
The options should work as described here:
1. Create a new Bigmon: the user then has the option to create a random Bigmon, or to enter
the information manually.
2. List all the Bigmons: the FightMenu class has an array of 10 Bigmons. Here the program will print a list with the information of all of them. Obviously, when you use option 1, the new Bigmon is stored in a free position of this array.
3. Delete a Bigmon: the user chooses a number between 0 and 9, and that position in the array is made empty (null).
4. Heal a Bigmon: the user chooses a number between 0 and 9, and if that position in the array is not empty (!= null), the Bigmon recovers all the life points, and is back in normal form.
5. Delete all dead Bigmons: go through the array, making each position with a dead Bigmon (life points are 0) empty.
6. Fight! The user chooses 2 positions of the array, and a fight starts.
Hint: The menu is really easy. You probably need to use a loop that repeats constantly while the user doesn't enter “0” with the keyboard.
Apr 3 '08 #1
1 1964
13,262 8TB
We don't do people's assignments here. See the help link at the top of this page for more details.
You have to do it yourself. We'll only help if we can see that you are doing something.
Apr 3 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Tony Archer | last post by:
Gentlemen, your urgent help is needed in solving a STRANGE problem. I have two servers a dev box, and a production box. On the dev box...
by: Tony Archer | last post by:
(Forgive the dupicate post, I had left out the OS Version out of the prior post.) Gentlemen, your urgent help is needed in solving a STRANGE...
by: WantedToBeDBA | last post by:
Hi all, We have db2 installed on AIX box (db2 version - 8.1). Its started and i am able to view 50000(default port) in netstat(netstat -a -n). But...
by: swaroopa | last post by:
Hello Partner Please forward some good resumes with excellent communication skills. 1.REMEDY AR CONSULTANT Exp: 6-10YEAR Location: San...
by: bparanj | last post by:
Hello, I have been a software developer for the past 10 years now. I get job descriptions that requires problem-solving skills as one of the most...
by: bprasanth_20 | last post by:
Hi, I need an urgent help. I need to create a UDF (User Defined Function) in DB2 SQL which can accept any number of arguments (from 2 to 5...
by: prakashsurya | last post by:
helllo, d problem is wen d curser jumps frm a combo box 2 a text field in a form d validations r nt working fr d text field....tel me wat shud i...
by: koonda | last post by:
Hi all, I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four...
by: toprahman | last post by:
Hi guys, I'm a student teacher at a high school in Washington D.C. and I've come across a slight problem. See, I'm a math major, but one of the...
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.