First, returning -1 in the failure case is not the best plan, since it's possible to have a valid result of -1. There are a few ways to address this problem. One is by throwing an exception, another is by also returning a separate boolean status of the operation.
Second, you probably want to return a double rather than an int to retain the precision of the calculation.
you'r calculations are wrong and the return function is flawed. to correctly calculate the percent difference between two numbers, you must first find the difference (hence percent DIFFERENCE, which means by what percentage they differ) betweend your two numbers. Not to mention you dont include user input in your code. I would also recomend you not over complicate things by useing classes, as functions are a lot easier to handle.
notice how when you enter a greater number before a smaller number, it comes positive anyway. Also note that i use no classes at all. Life's simpler this way...
@IWishIKnew
Your calculations are also incorrect, and you don't need to give the OP a hard time for the structure of his code when it is not wrong -- his choice of a function is generally a much better decision than inlining the code for a separable calculation.
At no point should the denominator be the sum of inputs. Also, lines 16-19 make no sense.
Be careful when you criticize others' code or methodologies -- you very likely don't understand everything there is to know about it -- all you know is what the OP posted about a specific piece of it.
16-19 are to prevent negative outputs by the program. if variable 'percent' is less than zero, it is negative, and percents arent negative, so we make it positive.
Also, i tried to answer to the best of my abilities, and that's about all I can do. ^^ I hope I helped somewhat.