Anyone pls solve this
Answers
Answer:
package com.sample.sample2;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
System.out.println("Enter name:");
String name=scan.next();
System.out.println("Enter basic salary:");
double basic=scan.nextDouble();
double da=0,sa=0,grossSalary;
if(basic>=10000){
da=0.1*basic;
sa=0.05*basic;
}
else if(basic>=20000&&basic<=10001){
da=0.12*basic;
sa=0.08*basic;
}
else if(basic>=30000&&basic<=20001){
da=0.15*basic;
sa=0.1*basic;
}
else if(basic>=20000){
da=0.2*basic;
sa=0.12*basic;
}
else System.out.println("error!!!");
grossSalary=basic+da+sa;
System.out.println("Name\t\tBasic\t\tDA\t\tSpl Allowance\t\tGross Salary");
System.out.println(name+"\t\t "+basic+"\t\t"+da+"\t\t"+sa+"\t\t "+grossSalary);
}
}