Hi every one!
I just got a book about a week ago on Java, and its going great! I just can't find how to add an x integer squared and a y integer squared. Here is the code i currently have :
class XYZ { public static void main(String[] args){ int x = 300; System.out.println("The squate root of " + x + " is " +Math.sqrt(x) ); int y = 146; System.out.println("The square root of " + y + " is " +Math.sqrt(y) ); } }
What I can't seem to get right is adding the result of x and y squared, I am using a book ( Sam's Java in 24 hours, I am a Self-learning teen) to learn Java, this will be the first program I will wright on my own so please don't give the answer just an example I can use to know what is wrong or how I cloud do it (the harder the better I really want to try this with no answers on the next page).
I tried thisI keep getting errors and the Net Beans IDE flags with this messageint z = 0; System.out.println("The square root of 300 + 146 is "); double x = y ; System.out.print(z);
" x is already defined in main(java.lang.String[])"
I really don't have a clue what that means, please tell me anyone who knows what those message mean.
Thanks all!
-Melawe