Salary Computation: Danny has recently got his job offer as an Event Concept Creator at Sparsh Event Services. The Company has sent him a detailed salary structure with details of his basic salary, HRA and DA. The Company has promised to pay him as under:
If his basic salary is less than Rs. 15000, then HRA = 15% of basic salary and DA = 90% of basic salary.
If his basic salary is either equal to or above Rs. 15000, then HRA = Rs. 5000 and DA = 98% of basic salary.
If the Danny’s salary is given as input, write a program to find his gross salary.
Note : Gross Salary = Basic Salary+HRA+DA
Input Format:
First line of the input is an integer that corresponds to the basic salary of Danny.
Output Format:
Output should display the double value that refers to the gross salary of Danny. Display the output correct to 2 decimal places.
Refer sample input and output for formatting specifications.
Sample Input 1:
12000
Sample Output 1:
24600.00
Sample Input 2:
30000
Sample Output 2:
64400.00
Solution
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
//sauravhathi
if (n < 15000) {
System.out.printf("%.2f", n+n*0.15+n*0.9);
} else {
//sauravhathi
System.out.printf("%.2f", n+5000+n*0.98);
}
}
}#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n<15000)
{
printf("%.2f",n+n*0.15+n*0.9);
}
else
{
printf("%.2f",n+5000+n*0.98);
}
return 0;
}n = int(input())
if n < 15000:
print("{:.2f}".format(n+n*0.15+n*0.9))
else:
print("{:.2f}".format(n+5000+n*0.98))Happy Learning – If you require any further information, feel free to contact me.
![[Solved] Salary Computation with Java, C++, Python [Solved] Salary Computation with Java, C++, Python](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Salary-Computation-with-Java-C-Python.png)
![Write a class ReorderArray with a public method reorder that takes one parameter arr of type int[] and returns the arr such that all even numbers in the array come to the front of the arr](https://realcoder.techss24.com/wp-content/uploads/2022/06/Write-a-class-ReorderArray-with-a-public-method-reorder-that-takes-one-parameter-arr-of-type-int-and-returns-the-arr-such-that-all-even-numbers-in-the-array-come-to-the-front-of-the-arr-300x200.png)
![[Solved] Data Mining-while with C++](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Data-Mining-while-with-C-300x200.png)
![[Solved] Maximum Element In Each Row with Java](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Maximum-Element-In-Each-Row-with-Java-300x200.png)