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