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.
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()
}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
Four of the lines of code labeled //1 to //6 ought to cause errors. State which lines should cause the errors and why.
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?
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.
Originally Posted by miney
Actually we allowed to upload those kind of to the forum, but not encourage to move with.
Originally Posted by JosAH