// Practical 7A (Revision) - Q // Marcus Ward // 26/10/2011 /* User will enter a number, and using the conditional operator "?:" the program will display if pos. or neg. */ import java.util.Scanner; public class PositiveOrNegativeNumber { public static void main(String[] args) { Scanner keyboardIn = new Scanner(System.in); // declare variables int digit; // get user input System.out.print("Enter a number: "); digit = keyboardIn.nextInt(); System.out.println(digit>=0?"The number is positive":"The number is negative"); } }