Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MuradHomeWork;
- import java.util.Scanner;
- public class Bank {
- public static void main(String[] args) {
- String ownerName;
- double balance;
- Scanner in = new Scanner(System.in);
- Account account1 = new Account(123,"Murad", 100);
- account1.deposit(145.9);
- Account accounts[] = new Account[5];
- for(int i=0; i<2; i++){
- System.out.println("Please enter your name");
- ownerName = in.next();
- System.out.println("Please put money in your start balance");
- balance = in.nextDouble();
- accounts[i] = new Account(i+1, ownerName , balance);
- }
- System.out.println("Please enter the number of your account");
- int accountNumCheck = in.nextInt();
- System.out.println("Please enter the name of your account");
- String ownerNameCheck = in.next();
- boolean accountCheck = true;
- for(int i=0; i<2; i++) {
- if(accountNumCheck == accounts[i].getAccountNum() && ownerNameCheck.equals(accounts[i].getOwnerName())) {
- accountCheck = true;
- System.out.println("Your balance is " + accounts[i].getBalance());
- break;
- }
- else
- accountCheck = false;
- }
- if(accountCheck == false)
- System.out.println("Error");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement