Online Java Compiler By
JavaTpoint.com
import java.util.Scanner; public class FloatShortValueExample2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.err.print("Enter your percentage : "); Float f1 = scanner.nextFloat(); if(f1<101){ short f2 =f1.shortValue(); //System.out.println("Percantage"+); if(f2>94){ System.out.println("You % matches with the FIRST cut off list"); } else if(f2>89&&f2<95){ System.out.println("You % matches with the SECOND cut off list"); } else if(f2>82&&f2<90) { System.out.println("You % matches with the THIRD cut off list"); } else{ System.out.println("If seats are left, we will update FOURTH cut off list and than you can try."); } } else System.out.println("Enter a valid percentage"); } }
Output