This is the program I'm working on and I'm completely lost
A Pythagorean triple is a set of numbers A, B, C such that A2 + B2 = C2. Write a subroutine that determines if 3 given numbers are a Pythagorean triple. The subroutine should print out an appropriate comment in each case. Test your solution with these sets; (3, 4, 5) and (7, 2, 9)

This is what I have so far

import java.util.*;
public class {
public static void main(String[] args){
Scanner in = new Scanner(System.in);

System.out.println("Enter a number.");
int num1   = in.nextInt();
System.out.println("Enter a second number.");
int num2   = in.nextInt();
System.out.println("Enter third number.");
int num3   = in.nextInt();

Triple(int num1,int num2,int num3);
}// end main()

static void Triple(int num 1, int num2,int num3 ) {

int square1=int num1* int num1;
int square2=int num2* int num2;
int square3=int num3* int num3;

if (((square1 + square2) == square3){ 
System.out.println("Good job you got a Pythagorean triple.");}
else{
System.out.println("That was NOT a Pythagorean triple.");
}

Please note I'm using notepad not visual basic or anything like that.
Thanks

At first glance,

static void Triple(int num 1, int num2,int num3 ) {

this seems to be your only problem. You have separated the variable name in your num1 variable. You have num 1.

Member Avatar for ztini

Please note I'm using notepad not visual basic or anything like that.
Thanks

Hi, Eclipse, Netbeans, and BlueJay are all free downloads. No one will think you're cool for doing it in notepad -- but everyone (including employers) will think you're an idiot for not using an IDE. Don't set yourself up for failure. :D

commented: tru dat +0

Hi, Eclipse, Netbeans, and BlueJay are all free downloads. No one will think you're cool for doing it in notepad -- but everyone (including employers) will think you're an idiot for not using an IDE. Don't set yourself up for failure. :D

I assume he is using notepad because he does not want to "automatically" know how to write java. He wants to learn it first. That way, when he goes to an interview, and the interviewer asks him how to solve a certain java problem, on paper, he won't ask why there is no auto complete. :P

Member Avatar for ztini

I wonder how well he'll do without knowing how to use a debugger, haha...2 weeks and a 100k lines of code later... :P

Either way, BlueJay is probably the way to go -- entry level IDE without auto-complete and no drag-and-drop GUI plugins.

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.