Online Java Compiler By
JavaTpoint.com
import java.util.Scanner; public class FloatLongValueExample3 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter your annual income"); Float d1 = scanner.nextFloat(); Long val1 = d1.longValue() / 12; System.out.println("Your monthly income is:"+val1); if (val1 < 30000 ) { Long l1= val1 + 2000; System.out.println("You got an increment of 5000.\nYour new salary is:" +l1); } else if (val1 >30000 && val1< 80000) { Long l1= val1 + 5000; System.out.println("You got an increment of 5000.\nYour new salary is:" +l1); } else if (val1 > 80000 && val1<100000) { Long l2= val1 + 8000; System.out.println("You got an increment of 8000.\nYour new salary is:" + l2); } else if(val1>100000) { Long l3= val1 + 15000; System.out.println("You got an increment of 15000.\nYour new salary is:" + l3); } } }
Output