Computer Science, asked by darshagarwal20066, 2 months ago

A company announces revised Dearness Allowance (DA) and Special Allowances (SA)
for their employees as per the tariff given below:
Dearness Allowance (DA)
Special Allowance (SA)
15%

Basic
Up to $ 10,000
10,001 - 20,000
20,001 - <30,000

5%
8%
10%
12%

20%
25%
30%

<30,001 and above
Write a program to accept Basic Salary (BS) of an employee. Calculate and display
gross salary.
Gross Salary = Basic + Dearness Allowance + Special Allowance

Print the information in the given format:
DA
Spl. Allowance
Gross Salary


Basic

Answers

Answered by jigardharva291099
8

Answer:

import java.util.Scanner;

public class KboatSalary

{

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.print("Enter name: ");

String name = in.nextLine();

System.out.print("Enter basic salary: ");

double bs = in.nextDouble();

double da = 0.0, sa = 0.0;

if (bs <= 10000){

da = bs * 10.0 / 100.0;

sa = bs * 5.0 / 100.0;

}

else if (bs <= 20000){

da = bs * 12.0 / 100.0;

sa = bs * 8.0 / 100.0;

}

else if (bs <= 30000){

da = bs * 15.0 / 100.0;

sa = bs * 10.0 / 100.0;

}

else{

da = bs * 20.0 / 100.0;

sa = bs * 12.0 / 100.0;

}

double gs = bs + da + sa;

System.out.println("Name\tBasic\tDA\tSpl. Allowance\tGross Salary");

System.out.println(name + "\t" + bs + "\t" + da + "\t" + sa + "\t" + gs);

}

}

OUTPUT

BlueJ output of A company announces revised Dearness Allowance (DA) and Special Allowances (SA) for their employees as per the tariff given below: Write a program to accept name and Basic Salary (BS) of an employee. Calculate and display gross salary. Gross Salary = Basic + Dearness Allowance + Special Allowance Print the information in the given format: Name Basic DA Spl.

Answered by ghoshjhuma936
1

Answer:

import java.util.Scanner;

public class KboatSalary

{

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.print("Enter name: ");

String name = in.nextLine();

System.out.print("Enter basic salary: ");

double bs = in.nextDouble();

double da = 0.0, sa = 0.0;

if (bs <= 10000){

da = bs * 10.0 / 100.0;

sa = bs * 5.0 / 100.0;

}

else if (bs <= 20000){

da = bs * 12.0 / 100.0;

sa = bs * 8.0 / 100.0;

}

else if (bs <= 30000){

da = bs * 15.0 / 100.0;

sa = bs * 10.0 / 100.0;

}

else{

da = bs * 20.0 / 100.0;

sa = bs * 12.0 / 100.0;

}

double gs = bs + da + sa;

System.out.println("Name\tBasic\tDA\tSpl. Allowance\tGross Salary");

System.out.println(name + "\t" + bs + "\t" + da + "\t" + sa + "\t" + gs);

}

}

Similar questions