Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Problem01 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double income = Double.parseDouble(scan.nextLine());
- int months = Integer.parseInt(scan.nextLine());
- double moneyNeedPerMonth = Double.parseDouble(scan.nextLine());
- double additionalCosts = income * 0.3; // income - income * 0.7;
- double moneySavedPerMonth = income - additionalCosts - moneyNeedPerMonth;
- double percentSavedMoney = moneySavedPerMonth / income * 100;
- double totalSavedMoney = moneySavedPerMonth * months;
- System.out.printf("She can save %.2f%%%n", percentSavedMoney);
- System.out.printf("%.2f", totalSavedMoney);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement