Is using the break statement bad practice?

Animation code for java using netbeans 3.3.1

  • Produce a simple graphical image using appropriate Java code and the Elements package implement a simple animated graphic image as specified below. This will be done using the Elements drawing window class The complexity of the shapes used and drawing facilities available in the Element package must be complex. The emphasis is on the design and development of a suitable Java program to illustrate your design. The Image The image that you produce should be contained within a 200 x 200 pixel window and be something that you could animate in a fairly simple way. An animated image might be something like a ‘stick man’ where the limbs could move in a rudimentary way to simulate walking, or a bird shape drawn with 4 lines that ‘flies’ across the screen. On the other hand, it could be as simple as a ‘pac-man’ type image where a simple mouth shape is drawn in a slightly forward position each time with the mouth opening or closing so that it appears to move forward eating. To summarise, by animation we mean that the image should change over time (by being redrawn slightly differently) to give the impression of movement. (Hint: you could use the ‘waitNSeconds’ method introduced in lecture 5 to delay the computer until the next ‘frame’ of the image was drawn). Some other comments on the image: 1. The image must appear in an appropriately sized drawing window. 2. You must use only the drawing facilities available from the Elements drawing window class described in Bailey & Bailey(work book that we take refrence from) 3. Additionally, you may use colour from the awt colour class – java.awt.Color 4. There must be at least 2 lines of standard sized text at the bottom of the window to describe what the image is. Requirements You are required to do the following: 1. Each feature shown in your design must be drawn using a graphical object from the Element package. 2. You must code, test and document (using appropriate in-line comments) a Java program that implements your design. The following is not meant to be an exhaustive list, but amongst the main characteristics we will be looking at when marking this work are the following: · Code that is clearly laid out and easy to follow, uses meaningful identifiers, and that separates the declaration and the initialisation/instantiation of variables. · An appropriate level of explanatory comments (i.e. where they are helpful and necessary, not on every statement). · The use of methods as a code-structuring mechanism to break the code down into logical blocks that mirror your design. It should be possible to read just your main method in order to see what your program is doing. If your code is one long sequence of statements it will not be possible to achieve more that a bare pass mark. Assessment The following criteria will be used to assess the understanding of the work · A basic image design using perhaps 2 or 3 shapes · At least the basic features of graphic have been implemented in Java · Basic use of the drawing tools of the element package · Basic animation (2-3 frames of movement) · Code is appropriately structured and documented (in-line) · At least two colours have been used · More complex image design attempted and presented · Most features of the design have been implemented · Advanced use of some drawing features of the element package · Use of multiple colours and more detailed animation · Clear and well presented design documentation · Well structured and documented code using methods · Complex image design successfully implemented · Smooth and fairly detailed animation · The code is very well structured with advanced use of methods · Evidence of appropriate planning at both design and implementation phases · Advanced use of the drawing facilities of the element package I am using Netbeans verstion 3.3.1 and the text to which i am using as a refrence is Baily and Baily. I Know i have included alot of info on the question thats because i have used tis service before and have learnt and advised to "add as much information as possible".Hope you can answer this question.It would be greatlty appreciated if you were able to answer this question before or by thursday Thankyou

  • Answer:

    Hi there shaz_600. I've since had a closer look at the Elements package, and it certainly seems to be the right one - so I've gone ahead and finished the code for you. It's available from: http://xult.org/shaz_600/MainWindow.java http://xult.org/shaz_600/Animation.java http://xult.org/shaz_600/ScreenSetup.java Additionally, you may see a screenshot of the animation below. It features a house, with a chimney blowing smoke. A FedEx truck races up to the house, and every 75 frames the animation restarts. http://xult.org/shaz_600/anim.gif Let me give you a short overview of how the code works. If you feel that you need more information, please feel free to ask. The code assumes that the Elements classes are stored in the normal place, and uses the statement: import element.* to import these. If your system stores these classes elsewhere, you may need to change that line in each of the files I provided. There are three classes: MainWindow: This class merely sets up a DrawingWindow and passes it to the Animation class. You must run this class to start the program (the command "java MainWindow" should suffice, once all classes are compiled). Animation: This class runs as a thread, and performs most of the hard work in the animation. It draws all of the moving items on the screen, and works out where they should be placed each frame. ScreenSetup: This class draws all the basic things which never need to be changed. For instance, the sun, the grass, and the sky. The code is well organized and fully commented, so it should be fairly easy for you to work on and understand. If, however, you need further assistance or help in understanding it, then please do not hesitate to use the request clarification feature before rating this answer. Thanks for an interesting challenge, and good luck with your course. --seizer-ga PS - If this is a school assignment, you may be interested to know that Google has a specific category for getting help with these. It's located at: Google Answers > Reference, Education and News > Homework Help If in the future you have more questions for us which are school related, I'd advise you to post your question(s) there to receive more appropriate attention. Thanks!

shaz_600-ga at Google Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.