class P3
{

public static void main (String[] args)
{
makeP3Picture();
}

public static Picture makeP3Picture(Picture source)
{
String fileName = FileChooser.pickAFile();
String sourceFile = FileChooser.getMediaPath("butterfly1.jpg");

Picture sourcePicture = new Picture(fileName);
Picture targetPicture = new Picture(source.getWidth()*3, source.getHeight()*2);

source.explore();
source.copyPhoto();
source.show();

return sourcePicture;
}
}

im getting the error: "makeP3Picture(Picture) in P3 cannot be applied to ()" on line "makeP3Picture();" I'm not sure what to do to fix it.

Recommended Answers

All 4 Replies

The compiler is complaining because it can not find a method named: makeP3Picture() with no arguments.
The compiler does find a method that takes a Picture object.
Do you have a Picture object that you can use when you call that method?

what does "public static Picture makeP3Picture(Picture source)" this line of code mean... I don't know what it means where it says picture source in the ( )

It requires an argument that is an object of type Picture. You are calling the method without any arguments, and while the class writer could have included a version of the method that takes no arguments, they did not. As a result, the compiler is telling you that you are missing an argument of type Picture. Clear yet?

makeP3Picture();

this is the method call you make.

public static Picture makeP3Picture(Picture source)

this is the actual signature of your method

a method is basically 'identified' by two things, to let the compiler know what method is being called:
1. the name of the method
2. the list of the parameters that are passed to it.

you can have both

public static Picture makeP3Picture()...

and

public static Picture makeP3Picture(Picture source)...

in the same class, since they are not the same. they are different by the parameters they take: the first one takes none, the second one takes a parameter of the type Picture.

in your call, you are trying to call a method without parameters, but you didn't add that method in your code. either you have to add a method without parameters in your code, or you should add a Picture argument to that call.

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.