suatkkrer
2/20/2020 - 12:57 PM

getSetBankAccount

package com.company;

public class BankAccount {

    private String number;
    private double balance;
    private String customerName;
    private String customerEmailAddress;
    private String customerPhoneNumber;

    public BankAccount(){
        this(   "4124",
                2.50 ,
                "Default name " ,
                "Default address" ,
                "default phone");

        System.out.println("Empty constructor called");
    }

    public BankAccount(String number,double balance, String  customerEmailAddress,String customerName,String customerPhoneNumber){
        System.out.println("Account constructor with parameters");
        this.number = number;
        this.balance = balance;
        this.customerEmailAddress = customerEmailAddress;
        this.customerName = customerName;
        this.customerPhoneNumber = customerPhoneNumber;
    }

    public BankAccount(String customerName, String customerEmailAddress, String customerPhoneNumber) {
        this("99999",100.55,customerName,customerEmailAddress,customerPhoneNumber);
        this.customerName = customerName;
        this.customerEmailAddress = customerEmailAddress;
        this.customerPhoneNumber = customerPhoneNumber;
    }

    public void deposit(double depositAmount){
        this.balance += depositAmount;
        System.out.println("Deposited " +depositAmount + " New Balance is " + this.balance);
    }

    public void withdrawal(double withdrawalAmount){
        if (this.balance - withdrawalAmount < 0){
            System.out.println("Only " +this.balance + " available. Withdrawal not processed");
        } else {
            this.balance -= withdrawalAmount;
            System.out.println("Withdrawal of " + withdrawalAmount + " processed. Remaining balance = " + this.balance);
        }
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getCustomerEmailAddress() {
        return customerEmailAddress;
    }

    public void setCustomerEmailAddress(String customerEmailAddress) {
        this.customerEmailAddress = customerEmailAddress;
    }

    public String getCustomerPhoneNumber() {
        return customerPhoneNumber;
    }

    public void setCustomerPhoneNumber(String customerPhoneNumber) {
        this.customerPhoneNumber = customerPhoneNumber;
    }
}
package com.company;

public class Main {

    public static void main(String[] args) {

//        BankAccount bobsAccount = new BankAccount("12345",0.00, "bobs@gmail.com" , "Bob Brown" , "4863285612");
//        System.out.println(bobsAccount.getBalance());
//        System.out.println(bobsAccount.getCustomerEmailAddress());
//
//        bobsAccount.withdrawal(100.0);
//
//        bobsAccount.deposit(50);
//        bobsAccount.withdrawal(100);
//
//        bobsAccount.deposit(51);
//        bobsAccount.withdrawal(100);
//
//        BankAccount timsAccount = new BankAccount("Tim","tim@email.com","4127421");
//        System.out.println(timsAccount.getNumber() + " name " + timsAccount.getCustomerName());
//    }
        VipCustomer suatVip = new VipCustomer("suat","suat@gmail.com",100);

        System.out.println(suatVip.getName());

        VipCustomer person1 = new VipCustomer();
        System.out.println(person1.getName());

        VipCustomer person2 = new VipCustomer("ses" , "gmail");
        System.out.println(person2.getName());
    }
}