-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.java
More file actions
70 lines (57 loc) · 2.54 KB
/
Main.java
File metadata and controls
70 lines (57 loc) · 2.54 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
import deals.Deal;
import deals.Expenditure;
import deals.Sale;
import taxes.Tax15;
import taxes.Tax6;
import java.util.Random;
import java.util.Scanner;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
Tax6 tax6 = new Tax6();
Tax15 tax15 = new Tax15();
Company[] companies = {
new Company('A', tax6),
new Company('B', tax15),
new Company('C', tax6),
new Company('D', tax15),
new Company('E', tax15)
};
Deal[][] dealsCompany = {
{new Sale("мебель", 200), new Sale("инструменты", 300), new Expenditure("мебель", 100)},
{new Sale("фрукты", 30), new Sale("овощи", 50), new Expenditure("фрукты", 1000)},
{new Sale("мебель", 1000), new Sale("инструменты", 150)},
{new Sale("путевка", 20000)},
{new Sale("книги", 150), new Sale("канцелярия", 10), new Expenditure("мебель", 1000)}
};
// изменим УСН для компании 'E' с 15% на 6%
companies[4].setTaxes(tax6);
Scanner scanner = new Scanner(System.in);
Random random = new Random();
// период, за который рассчитываем налог
System.out.print("Введите целое число:");
int amount;
int days = Math.abs(scanner.nextInt());
for (int i = 0; i < companies.length; i++) {
System.out.printf("Компания %s (%s):\n", companies[i].title, companies[i].tax.typeTax());
for (int j = 0; j < days; j++) {
amount = random.nextInt(-100, 256);
companies[i].shiftMoney(amount);
System.out.format("%5d", amount);
}
System.out.println();
System.out.println("Итого: доход = " + companies[i].debit + " расход = " + companies[i].credit + "\n");
companies[i].applyDeals(dealsCompany[i]);
companies[i].payTaxes(companies[i].tax);
System.out.println();
}
// CalculateTaxes(companies);
}
public static void CalculateTaxes(Company[] companies) {
for (int i = 0; i < companies.length; i++) {
companies[i].payTaxes(companies[i].tax);
System.out.println();
}
}
}