zoukankan      html  css  js  c++  java
  • 小项目--bank2

    package banking2;

    public class Customer {
    private String firstName;
    private String lastName;
    private Account account;
    public Customer(String f,String l){
    firstName=f;
    lastName=l;
    }
    public String getFirstName(){
    return firstName;
    }
    public String getLastName(){
    return lastName;
    }
    public Account getAccount(){
    return account;
    }
    public void setAccount(Account acct){
    account = acct;
    }
    }

    package testbanking1;
    import banking2.*;

    public class testbanking2 {
    public static void main(String[] args){
    Customer customer;
    Account account;
    account =new Account(500.00);
    System.out.println("creating customer Jane Smith ");
    customer =new Customer("Jane" ,"Smith");
    customer.setAccount(account);//把account和customer联系起来
    System.out.println("creating her account with 500.00 balance");
    customer.getAccount().withdraw(150.00);
    System.out.println("withdraw 150.00");
    customer.getAccount().despoit(22.50);
    System.out.println("despoit 22.50");
    customer.getAccount().withdraw(47.62);
    System.out.println("withdraw 47.62");
    System.out.println("customer:"+customer.getFirstName()+customer.getLastName()+"account:"+account.getBalance());
    }
    }

  • 相关阅读:
    vue的单向数据流
    vue的组件基础
    vue v-for的数组改变导致页面不渲染解决方法
    Binary Heap
    Types of Binary Tree
    Merge Sort
    Master Theorem
    Insertion Sort
    Amazon Redshift and Massively Parellel Processing
    Bubble Sort
  • 原文地址:https://www.cnblogs.com/alhh/p/5342540.html
Copyright © 2011-2022 走看看