-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
96 lines (74 loc) · 3.61 KB
/
Copy pathMain.java
File metadata and controls
96 lines (74 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int earnings = 0;
int spendings = 0;
while (true){
System.out.println();
System.out.println("Выберите операцию и введите её номер: ");
System.out.println("1. Добавить новый доход ");
System.out.println("2. Добавить новый расход ");
System.out.println("3. Выбрать систему налогообложения ");
System.out.println();
System.out.println("* Для завершения программы введите end");
System.out.println();
String input = scanner.nextLine();
if("end".equals(input)){
System.out.println();
System.out.println("Программа завершена");
break;
}
int operation = Integer.parseInt(input);
switch (operation){
case 1:
System.out.println();
System.out.println("Введите сумму дохода");
System.out.println();
String moneyStr = scanner.nextLine();
int money = Integer.parseInt(moneyStr);
earnings += money;
break;
case 2:
System.out.println();
System.out.println("Введите сумму расхода");
System.out.println();
String money2Str = scanner.nextLine();
int money2 = Integer.parseInt(money2Str);
spendings += money2;
break;
case 3:
int option1 = EarningsOnly.tax(earnings);
int option2 = EarningsMinusSpendings.tax(earnings, spendings);
String bestOption = "";
int taxAmount = 0;
int otherTax = 0;
int profit = 0;
if(option1 < option2){
bestOption = "УСН доходы";
taxAmount = option1;
otherTax = option2;
profit = option2 - option1;
}else{
bestOption = "УСН доходы минус расходы";
taxAmount = option2;
otherTax = option1;
profit = option1 - option2;
}
System.out.println();
System.out.println("_________________________________");
System.out.println("Мы советуем вам " + bestOption );
System.out.println("Ваш налог составит: " + taxAmount );
System.out.println("Налог на другой системе: " + otherTax );
System.out.println("Экономия: " + profit );
System.out.println("_________________________________");
System.out.println();
break;
default:
System.out.println();
System.out.println("Такой операции нет");
}
}
scanner.close();
}
}