import java.util.Scanner ; public class Task9 { public static void main (String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter Basic Salary : "); double basicSalary = input.nextDouble(); double houseRent=0,MedicalAllowance=0; if(basicSalary<10000){ houseRent = (basicSalary*50)/100; MedicalAllowance = (basicSalary*10)/100; }else if(basicSalary>=10000&&basicSalary<=20000){ houseRent = (basicSalary*60)/100; MedicalAllowance = (basicSalary*15)/100; }else if(basicSalary>20000){ houseRent = (basicSalary*70)/100; MedicalAllowance = (basicSalary*20)/100; } double GrossSalary = basicSalary + houseRent + MedicalAllowance; System.out.printf("\n Gross Salary is %.2f",GrossSalary); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter