objective: Write a class Bug that models a bug moving along a horizontal line. The bug moves either to the right of to the left. Initially, the bug moves to the right, but it can turn to change its direction. Provide a constructor. All methods are included below.

public class Bug {

    public Bug(int initial position)
    {
    	position= initialPosition;
    }
    public void turn();
    {
    	double newOrientation = count* -1;
    }
    public void move();
    {

    }
    public int getPosition();

    


}

Recommended Answers

All 6 Replies

??? Are you doing GUI? Or are you displaying out on a console??? Also, you need to implement as well, not just a skeleton like this with nothing to help understanding at all...

i wrote the objective above. I dont know what GUI is?

Can someone help me?

So how would you test the Bug class then? What does your sample test look like?

> Can someone help me?

Not if you don't ask specific questions.

Please specify your question because your question is still questionable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.