Results 1 to 5 of 5

Thread: Java BlueJ

  1. #1
    miney is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default Java BlueJ

    I am new in Java and I read a book about blueJ program (Frog ,HoverFrog,Toad) ,and I try to solve some Exercies but I some Problem Faced me >>
    so If any body can Help me
    In writing the code of the below methods you can use the Frog methods in table1.
    Message Frog
    left() Move one stone to the left.
    right() Move one stone to the right
    home() Move to position 1
    jump() Jump up and return to its position
    setPosition(int) Set position attribute to argument value.
    setColour(OUColour) Set colour attribute to argument value









    Table 1 Frog class methods


    (i) Assume an interface called Dancer is defined as follows:

    public interface Dancer
    {
    public void danceSteps(int n);
    }

    a. Write a class called DancerFrog that inherits Frog class and implements Dancer interface. The DancerFrog class has no attributes but it has the following members:
    b. A DancerFrog constructor that invokes parent constructor for initialization.

    c. getReady(): is a helper method that takes no argument and returns no values. In this method the DancerFrog instance should be in red colour and should stand on position 6 Note that: a helper method is a private method not public.
    private void getReady()
    {
    this.setPosition(6);
    this.setColour(OUColour.RED);
    }
    d. danceSteps(int n): the DancerFrog instance should invoke getReady(). Then the following steps should be repeated number of times according to argument n: move right twice, jump, and finally move left.
    e. home(): the DancerFrog instance override the inherited method home() such that in addition to return back frog to position 1, it returns back its colour to green.
    (ii) After writing the class DancerFrog, a programmer executes the following lines of code, one at a time in the OUWorkspace.
    Dancer sam = new Dancer(); //1
    Dancer helen = new DancerFrog(); //2
    Frog kermit = new DancerFrog(); //3
    DancerFrog alice = new Frog(); //4
    kermit.danceSteps(); //5
    helen.getReady(); //6

    Four of the lines of code labeled //1 to //6 ought to cause errors. State which lines should cause the errors and why.

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    4

    Default

    I don't see a question here... I see a problem with no solution. You said you attempted to solve it but came across a problem. What is the exact problem you encountered, and with what code did you have this error?

  3. #3
    miney is offline Member
    Join Date
    Oct 2010
    Posts
    4
    Rep Power
    0

    Default

    in the attachment what I did
    Attached Files Attached Files

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,005
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by miney View Post
    in the attachment what I did
    Don't throw a .zip file towards us; simply ask your question; if needed post a bit of code that shows your problem. Nobody is going to open that .zip archive with all sorts of unknown files and plough their way through to figure out what your question is.

    kind regards,

    Jos

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by JosAH View Post
    Don't throw a .zip file towards us; simply ask your question; if needed post a bit of code that shows your problem. Nobody is going to open that .zip archive with all sorts of unknown files and plough their way through to figure out what your question is.

    kind regards,

    Jos
    Actually we allowed to upload those kind of to the forum, but not encourage to move with.

Similar Threads

  1. Simple Java BlueJ Converting Program
    By Mahoo in forum New To Java
    Replies: 3
    Last Post: 08-04-2010, 05:28 AM
  2. Java Slideshow in BlueJ...Help!
    By MarkL410 in forum New To Java
    Replies: 5
    Last Post: 06-24-2010, 04:16 AM
  3. BlueJ help
    By Cid17 in forum New To Java
    Replies: 2
    Last Post: 06-29-2009, 07:38 PM
  4. Java Applet Help with BlueJ
    By moofs in forum New To Java
    Replies: 0
    Last Post: 01-15-2009, 04:24 AM
  5. BlueJ 2.2.0
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-07-2007, 02:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •