Advertisement
Spocoman

Savings

Sep 1st, 2024
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double salary = Double.parseDouble((scanner.nextLine()));
  7.         int months = Integer.parseInt((scanner.nextLine()));
  8.         double minimalCosts = Double.parseDouble((scanner.nextLine()));
  9.  
  10.         double monthlySavings = salary * 0.70 - minimalCosts;
  11.  
  12.         System.out.printf("She can save %.2f%%\n%.2f", monthlySavings / salary * 100, monthlySavings * months);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement