All pastes #759781 Raw Edit

netsurf

public java v1 · immutable
·published 2007-11-03 14:46 UTC
rendered paste body
// 1.Design and implement a method to input an integer in a specified range. The range should be specified by two parameters and the value input should be returned by the method. The method should prompt until a valid number is entered.import java.util.*;public class validation{// main method calling my varify method	public static void main (String[] args)	{	//print my varify method instead of adding an extra line		System.out.println(varify(50, 100));					}	// creating my varify method, must run a loop and continue doing so until a correct value is entered which fits the parameter variables.	public static int varify (int range0, int range1)	{		int num = 0;		Scanner keyb = new Scanner(System.in);		while ((num > range0) && (num < range1))		{			System.out.println("enter number");			num = keyb.nextInt();		} 		return num;	}}