coderrohan14

Conditionals_Ques_1.java

Jun 24th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Solution {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. String[] str = sc.nextLine().split(" ");
  7. double salary = Double.parseDouble(str[0]);
  8. double hra = (20*salary)/100;
  9. double da = (50*salary)/100;
  10. double pf = (11*salary)/100;
  11. double ans = salary+hra+da-pf;
  12. if(str[1].equals("A")){
  13. ans+=1700;
  14. }else if(str[1].equals("B")){
  15. ans+=1500;
  16. }else{
  17. ans+=1300;
  18. }
  19. System.out.println(ans);
  20. }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment