This project simulates basic banking operations using integer variables. It demonstrates how to perform balance transfers between accounts and apply bonuses using fundamental arithmetic operations in Java.
- Declare two
intvariables:account1with a value of 100 andaccount2with a value of 200. - Transfer funds:
- Update
account2by adding the value ofaccount1to it. - Set
account1to 0.
- Update
- Apply a bonus:
- Increase
account1by 50.
- Increase
- Display the final balances of both accounts in the console.
After running the program, the console should display the following:
Balance of Account 1: 50
Balance of Account 2: 300
- Language: Java 23
- IDE: IntelliJ IDEA
- Concepts: Variable initialization, Integer arithmetic, Console output.
The code follows Java naming conventions and clean code principles.
The code uses simple assignment and addition to manage the state of the accounts:
public class Task_8_App {
public static void main(String[] args) {
// Initializing bank accounts
int account1 = 100;
int account2 = 200;
// Transferring money from account1 to account2
account2 = account2 + account1;
account1 = 0;
// Adding a bonus of 50 to account1
account1 = account1 + 50;
// Displaying final account balances
System.out.println("Balance of Account 1: " + account1);
System.out.println("Balance of Account 2: " + account2);
}
}This project is licensed under the MIT License.
Copyright (c) 2026 Yurii Pavlenko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...
License: MIT