Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Gunner class implementation  RSS feed

 
Jann Kowalski
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey i'm having a hard time with this task(Code below):
I need to write class Gunner which extends abstract class GunnerA. The task of the class is to destroy the target using ShootingRules interface. Gunner class has to destroy the target using information "to close/ to far" and with the least number of shots possible.
Extra info: I can't modify GunnerA class, Gun and ShootingRules interface. Gunner class have to use no-argument constructor.
Can you give me any tips how to start ? some examples ?








 
Pat Farrell
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
 
Jann Kowalski
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Umm, and where exactly did i try to ask for a complete solution? I clearly asked for TIPS on how to start or some examples (not necessarily with the code i posted).
I just don't have an idea on how to start developing this code (however silly it may sound for others). Sorry if I made it look like I want a 'free homework'.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The usual answer to 'where to start' is on pencil and paper. Think about the requirements. The first thing to do is pick just one requirement. Then take that requirement and break it down in to small steps. This is where the pencil and paper come in - take those small steps and write them out on paper in the order you think they need to occur. Then take each step and (still on paper) and turn them into something that approximates code (pseudo code). Once you are sure you know how to get one task done in pseudo code, write the actual code in java and test it. Then fix it and test it again.

Then, when it works, take the next small step of the first requirements and do the same thing.

Before you know it you'll be done.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!