Question: Java string homework help. If there are any problems or questions please comment and let me know. Assignment It would be really cool if we

Java string homework help.

If there are any problems or questions please comment and let me know.

Assignment

It would be really cool if we could control our avatars via the command line and make them perform certain actions. To do this, we will write a program that allows a user to write a set of commands using flags to control the avatar. Flags can be chained together to create more complicated commands.

Your command line interface needs to work with the following flags:

-create: Creates a new avatar and prints an ID for that avatar to the screen, also makes this avatar the current avatar.

-loc x y : Changes the location of the current avatar to the location specified by x and y

-up p : Moves the current avatar up by p pixels

-down p : Moves the current avatar down by p pixels

-left p : Moves the current avatar left by p pixels

-right p : Moves the current avatar right by p pixels

-color c : Changes the avatar to the color denoted by c

-shutDown id: Hides the current avatar and does not allow us to interact with it any more (assuming the id is valid, otherwise nothing happens)

-quit : Kills the program

-changeTo id: Changes the avatar indicated by Id(assuming Id is valid, otherwise nothing happens)

Some example inputs your command line interface needs to handle are as follows:

//Create a new avatar, place it at 100, 100 and set its color to

//red

-create -loc 100 100 -color red

//Change control to avatar 3 and set its color to blue

-changeTo 3 -color blue

Important: For the avatar, our teacher is using an alternate library called wheelsunh. But I don't need you to create the avatar for me. Simply implement the methods will do.

However, this library is incredibly simple and I will show you the code to create an circle here so you can use these in the methods.

Ellipse testcircle = new Ellipse(); //Ellipse is shape type. testcircle is the shape name.

testcircle.setLocation(100,200); //setting the location of testcircle to x= 100, y = 200.

testcircle.setColor(Color.RED); //self explanatory.

testcircle.hide() //this hides the circle, which can be used for shutdown method mentioned above.

Thank you very much for your help!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!