CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 00:25:20 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=e8215ea8e41ad778ca81c4c2f1440c6116fa5275df53f87c5235ba4c48bc10e1a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%228BfQVSBqRjA1FKSgj4U_Hx5oy-ENwQV5%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d275a00888c19c-BLR
госы_транзакции_dart - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 9. Разработать программу для обработки и анализа списка финансовых транзакций за месяц. Каждая транзакция включает в себя информацию о дате, типе операции (доход или расход) и сумме. Программа должна подсчитать общий доход и расход за месяц, вычислить итоговый баланс и идентифицировать день с самым большим расходом. В конце работы программа предоставляет подробный отчет.
- void main() {
- final transactionManager = TransactionManager();
- transactionManager.addTransaction(
- Transaction(
- date: DateTime(2024, 07, 01),
- operation: Operation.income,
- transactionSum: 1000,
- ),
- );
- transactionManager.addTransaction(
- Transaction(
- date: DateTime(2024, 07, 05),
- operation: Operation.expense,
- transactionSum: 200,
- ),
- );
- transactionManager.addTransaction(
- Transaction(
- date: DateTime(2024, 07, 10),
- operation: Operation.expense,
- transactionSum: 300,
- ),
- );
- transactionManager.addTransaction(
- Transaction(
- date: DateTime(2024, 07, 15),
- operation: Operation.income,
- transactionSum: 1500,
- ),
- );
- transactionManager.addTransaction(
- Transaction(
- date: DateTime(2024, 07, 20),
- operation: Operation.expense,
- transactionSum: 100,
- ),
- );
- final report = transactionManager.report;
- print('Общий доход: ${report.resultIncome}');
- print('Общий расход: ${report.resultExpense}');
- print('Итоговый баланс: ${report.resultBalanse}');
- print('День с самым большим расходом: ${report.mostExpensesDay}');
- }
- enum Operation { income, expense }
- final class Transaction {
- final DateTime date;
- final Operation operation;
- final double transactionSum;
- const Transaction({
- required this.date,
- required this.operation,
- required this.transactionSum,
- });
- @override
- String toString() {
- return 'Transaction{date: $date, operation: $operation, transactionSum: $transactionSum}';
- }
- }
- final class TransactionManager {
- final List<Transaction> _transactions = [];
- void addTransaction(Transaction transaction) {
- _transactions.add(transaction);
- }
- Report get report => Report(_transactions);
- }
- final class Report {
- final List<Transaction> _transactions;
- const Report(this._transactions);
- double get resultIncome {
- var resultIncomeVar = 0.0;
- for (final transaction in _transactions) {
- if (transaction.operation == Operation.income) {
- resultIncomeVar += transaction.transactionSum;
- }
- }
- return resultIncomeVar;
- }
- double get resultExpense {
- var resultExpenseVar = 0.0;
- for (final transaction in _transactions) {
- if (transaction.operation == Operation.expense) {
- resultExpenseVar += transaction.transactionSum;
- }
- }
- return resultExpenseVar;
- }
- double get resultBalanse {
- return resultIncome - resultExpense;
- }
- DateTime? get mostExpensesDay {
- if (_transactions.isEmpty) {
- return DateTime.now();
- }
- double maxExpense = 0;
- DateTime? maxExpenseDate;
- for (final transaction in _transactions) {
- if (transaction.operation != Operation.expense) continue;
- final date = DateTime(
- transaction.date.year,
- transaction.date.month,
- transaction.date.day,
- );
- final expense = transaction.transactionSum;
- if (maxExpenseDate == null || expense > maxExpense) {
- maxExpense = expense;
- maxExpenseDate = date;
- }
- }
- return maxExpenseDate;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ E
JavaScript | 1 sec ago | 0.25 KB
-
📝 Exchange profit method
JavaScript | 1 sec ago | 0.24 KB
-
⭐⭐⭐MAKE $9OO INSTANTLY D G⭐⭐
Java | 9 sec ago | 0.10 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 3
JavaScript | 10 sec ago | 0.25 KB
-
⭐ Free Crypto Method ⭐
JavaScript | 11 sec ago | 0.24 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ G
JavaScript | 19 sec ago | 0.25 KB
-
📝 Crypto Swap Glitch ✅ Working
JavaScript | 22 sec ago | 0.24 KB
-
⭐⭐⭐Profit Method⭐⭐
Java | 22 sec ago | 0.10 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand