Advertisement
PamKacz94

Untitled

Apr 4th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3.  
  4. public class Salary {
  5.     public static void main(String[] args){
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         System.out.print("Days of work = ");
  9.         double daysOfWork = scanner.nextDouble();
  10.         System.out.print("Day salary = ");
  11.         double daySalary = scanner.nextDouble();
  12.         System.out.print("Rate USD = ");
  13.         double rateUSD = scanner.nextDouble();
  14.  
  15.         double monthSalary = daysOfWork * daySalary;
  16.         double bonus = monthSalary * 2.5;
  17.         double yearSalary = monthSalary * 12 + bonus;
  18.         double taxes = yearSalary * 0.25;
  19.         double grossSalary = yearSalary - taxes;
  20.         double averageDay = grossSalary / 365;
  21.  
  22.         double usdToBGN = averageDay * rateUSD;
  23.  
  24.         DecimalFormat decimalFormat = new DecimalFormat("#.##");
  25.  
  26.         System.out.print(decimalFormat.format(usdToBGN));
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement