just new to java and trying to do the following task:
Write a program which will take in two integer numbers as integer parameters from 'main'. e.g. main (int num1, int num2)
Your program should do the following:
1) print out the larger of the two numbers.
2) if they are equal, print out that they are equal
3) if either or both number is greater than 100, print out which one(s) are
4) if either number is less than zero, print "number must be zero or higher"
5) test your program to ensure it works for various combinations of input
Submit the program
I've wrote the program but I get a '.class' expected when I compile - can anybody help cos I'm new to this?
here's my program below:
public class comparison
{
public static void main(int num1, int num2)
{
if (int num1 > int num2)
System.out.println("int num1" is larger);
else if (int num2 > int num1)
System.out.println("int num2" is larger);
else if (int num1 = int num2)
System.out.println(''numbers are equal'');
else if ((int num1 || int num2) || (int num1 && int num2) > 100)
System.out.println.(''numbers are greater than 100'');
else if (int num1 || int num2 < 0)
System.out.println(''number must be zero or higher'');
}

New Topic/Question
Reply




MultiQuote






|