PDA

View Full Version : Program that takes a number from the user and verifies that it's between 7 and 11?


lostperson19999
Nov 1, 2014, 10:41 PM
That's really it... I have tried doing this but I am really not familiar with java. Any help is appreciated.

import java.util.Scanner;


public class assignment8 {


Scanner in = new Scanner(System.in);

public static void main(String[] args){

System.out.print("Please enter a number ");
Integer item1 = in.nextInt();

int value1 = 7;
int value2 = 11;

if(value1 == value2)
System.out.println("value1 == value2");
if(value1 != value2)
System.out.println("value1 != value2");
if(value1 > value2)
System.out.println("value1 > value2");
if(value1 < value2)
System.out.println("value1 < value2");
if(value1 <= value2)
System.out.println("value1 <= value2");
}
}