• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java constructor  RSS feed

 
xander aspiring
Greenhorn
Posts: 1
Android Chrome Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have migrate it this question from stackoverflow.

I need to fill in the constructor for a person class. I am new to Java and programming in general. This is what I need to do:

TODO #1: Fill in the rest of the arguments to the Person constructor The Person constructor should take in 3 additional arguments: 1) String pictureName 2) int xCoord 3) int yCoord

TODO #2: Fill in the rest of this constructor
You need to create a local variable called picture and assign to picture the picture that we want to use.

TODO #3: You need need to move the picture to xCoord and yCoord. You can move the picture object by calling the translate method. the last step is to draw the picture.

And this is what I've done but I get an error, and I don't know why. I believe that's what I need to do unless I am missing something. If someone could help me figure this out and and explain this very clear it would be exceptionally appreciated.


 
Paweł Baczyński
Bartender
Posts: 2083
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are trying to call method translate on String object.
String class does not have a translate method thus the error.

You need to create an object representing a picture given String with its name. Maybe it is in class Picture somewhere in your assignment?
I don't know. You didn't tell us. But it certainly is not String.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!