We help IT Professionals succeed at work.
Get Started

Can someone please help me with this simple java program

jtiernan2008
jtiernan2008 asked
on
186 Views
Last Modified: 2012-05-06
The question is to enter 3 numbers and find which is the larger of them but it will not run
Can someone please take a look at it.
import java.util.Scanner;
 
public class Largest {
	
	public static void main (String args[]) {
		
		Scanner input = new Scanner();
		
		int number1, number2, number3, weight1 = 0, weight2 = 0, weight3 = 0;
		
		System.out.println("Please enter the first number");
		number1 = input.nextInt();
		System.out.println("Please enter the second number");
		number2 = input.nextInt();
		System.out.println("Please enter the third number");
		number3 = input.nextInt();
		
		if ((number1 > number2) || (number 1 > number3)) {
			System.out.println("number 1 is the largest number");
		}
		
		if ((number2 > number1) || (number2 > number3)) {
			System.out.println("number 2 is the largest number");
		}
		
		if ((number3 > number 1) || (number3 > number1)) {
			System.out.println("number 3 is the largest number")
		}
		
		
		
	}
}

Open in new window

Comment
Watch Question
Vice President
Commented:
This problem has been solved!
Unlock 3 Answers and 7 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE