




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Java 基礎(chǔ)實(shí)戰(zhàn)Bank 項(xiàng)目 實(shí)驗(yàn)題目 1: 創(chuàng)建一個(gè)簡(jiǎn)單的銀行程序包 實(shí)驗(yàn)?zāi)康模?#160;Java 語(yǔ)言中面向?qū)ο蟮姆庋b性及構(gòu)造器的創(chuàng)建和使用。 實(shí)驗(yàn)說(shuō)明: 在這個(gè)練習(xí)里,創(chuàng)建一個(gè)簡(jiǎn)單版本的 Account 類(lèi)。將這個(gè)源文件放入 banking 程序包中。在創(chuàng)建單個(gè)帳戶(hù)的默認(rèn)程序包中,已編寫(xiě)了一個(gè)測(cè)試程序 TestBanking。這個(gè)測(cè)試程序初始化帳戶(hù)余額,并可執(zhí)行幾種簡(jiǎn)單的事物處理。最后,該測(cè)試程 序顯示該帳戶(hù)的最終余額。 提示: 1創(chuàng)建 banking 包 2 在 banking 包下創(chuàng)建
2、Account 類(lèi)。該類(lèi)必須實(shí)現(xiàn)上述 UML 框圖中的模型。 a. 聲明一個(gè)私有對(duì)象屬性:balance,這個(gè)屬性保留了銀行帳戶(hù)的當(dāng)前(或 即時(shí))余額。 b. 聲明一個(gè)帶有一個(gè)參數(shù)(init_balance)的公有構(gòu)造器,這個(gè)參數(shù)為 balance 屬性賦值。 c. 聲明一個(gè)公有方法 geBalance,該方法用于獲取經(jīng)常余額。 d. 聲明一個(gè)公有方法 deposit,該方法向當(dāng)前余額增加金額。 e. 聲明一個(gè)公有方法 withdraw 從當(dāng)前余額中減去金額。 3打開(kāi)TestBanking.java文件,按提示完成編寫(xiě),并編譯 Tes
3、tBanking.java 文件。 4 運(yùn)行 TestBanking 類(lèi)。可以看到下列輸出結(jié)果: Creating an account with a 500.00 balance Withdraw 150.00 Deposit 22.50 Withdraw 47.62 The account has a balance of 324.88 /TestBanking.java 文件/* * This class creates the program to test the banking classes.
4、0;* It creates a new Bank, sets the Customer (with an initial balance), * and performs a series of transactions with the Account object. */package test;import banking.*;public class TestBanking public static void main(String args) Account account; /
5、Create an account that can has a 500.00 balance. System.out.println("Creating an account with a 500.00 balance."); /code System.out.println("Withdraw 150.00"); /code System.out.println("Deposit 22.50"
6、); /code System.out.println("Withdraw 47.62"); /code / Print out the final account balance System.out.println("The account has a balance of " + account.getBalance(); Java 基礎(chǔ)實(shí)戰(zhàn)Bank 項(xiàng)目 實(shí)驗(yàn)題目 2: 擴(kuò)展銀
7、行項(xiàng)目,添加一個(gè) Customer 類(lèi)。Customer 類(lèi)將包含一個(gè) Account對(duì)象。 實(shí)驗(yàn)?zāi)康模?#160;使用引用類(lèi)型的成員變量。 提 示: 1. 在banking包下的創(chuàng)建Customer類(lèi)。該類(lèi)必須實(shí)現(xiàn)上面的UML圖表中的模型。 a. 聲明三個(gè)私有對(duì)象屬性:firstName、lastName 和 account。 b. 聲明一個(gè)公有構(gòu)造器,這個(gè)構(gòu)造器帶有兩個(gè)代表對(duì)象屬性的參數(shù)(f 和 l) c. 聲明兩個(gè)公有存取器來(lái)訪(fǎng)問(wèn)該對(duì)象屬性,方法 getFirstName 和 getLastName 返 回相應(yīng)的屬性。
8、 d. 聲明 setAccount 方法來(lái)對(duì) account 屬性賦值。 e. 聲明 getAccount 方法以獲取 account 屬性。 2. 在 exercise2 主目錄里,編譯運(yùn)行這個(gè) TestBanking 程序。應(yīng)該看到如下輸出結(jié)果: Creating the customer Jane Smith. Creating her account with a 500.00 balance. Withdraw 150.00 Deposit 22.50 Withdraw 47.62 Custom
9、er Smith, Jane has a balance of 324.88 /TestBanking.java 文件/* * This class creates the program to test the banking classes. * It creates a new Bank, sets the Customer (with an initial balance), * and performs a series of transactions with the Account object. */import banking
10、.*;public class TestBanking public static void main(String args) Customer customer; Account account; / Create an account that can has a 500.00 balance. System.out.println("Creating the customer Jane Smith."); /c
11、ode System.out.println("Creating her account with a 500.00 balance."); /code System.out.println("Withdraw 150.00"); /code System.out.println("Deposit 22.50"); /code System.out.printl
12、n("Withdraw 47.62"); /code / Print out the final account balance System.out.println("Customer " + customer.getLastName() + ", " + customer.getFirstName() + " has a balance of " + ac
13、count.getBalance(); Java 基礎(chǔ)實(shí)戰(zhàn)Bank 項(xiàng)目 實(shí)驗(yàn)題目 3: 修改 withdraw 方法以返回一個(gè)布爾值,指示交易是否成功。 實(shí)驗(yàn)?zāi)康模?#160;使用有返回值的方法。 提 示: 1 修改 Account 類(lèi) a. 修改 deposit 方法返回 true(意味所有存款是成功的)。 b. 修改 withdraw 方法來(lái)檢查提款數(shù)目是否大于余額。如果amt小于 balance, 則從余額中扣除提款數(shù)目并返回 true,否則余額不變返回 false。 2 在 exe
14、rcise3 主目錄編譯并運(yùn)行 TestBanking 程序,將看到下列輸出; Creating the customer Jane Smith. Creating her account with a 500.00 balance. Withdraw 150.00: true Deposit 22.50: true Withdraw 47.62: true Withdraw 400.00: false Customer Smith, Jane has a balance of 324.88 /TestBanking.java 文件/*
15、0;* This class creates the program to test the banking classes. * It creates a new Bank, sets the Customer (with an initial balance), * and performs a series of transactions with the Account object. */import banking.*;public class TestBanking public static void main(String args
16、) Customer customer; Account account; / Create an account that can has a 500.00 balance. System.out.println("Creating the customer Jane Smith.");/code System.out.println("Creating her account with a 500.00 b
17、alance."); /code / Perform some account transactions System.out.println("Withdraw 150.00: " + account.withdraw(150.00); System.out.println("Deposit 22.50: " + account.deposit(22.50); System.out.println(&qu
18、ot;Withdraw 47.62: " + account.withdraw(47.62); System.out.println("Withdraw 400.00: " + account.withdraw(400.00); / Print out the final account balance System.out.println("Customer " + customer.getLastName() + "
19、;, " + customer.getFirstName() + " has a balance of " + account.getBalance(); Java 基礎(chǔ)實(shí)戰(zhàn)Bank 項(xiàng)目 實(shí)驗(yàn)題目 4: 將用數(shù)組實(shí)現(xiàn)銀行與客戶(hù)間的多重關(guān)系。 實(shí)驗(yàn)?zāi)康模?#160;在類(lèi)中使用數(shù)組作為模擬集合操作。 提示: 對(duì)銀行來(lái)說(shuō),可添加 Bank 類(lèi)。 Bank 對(duì)象跟蹤自身與其客戶(hù)間的關(guān)系。用 Customer 對(duì)象的數(shù)組實(shí)現(xiàn)這個(gè)集合化的關(guān)系。還要保持一個(gè)整數(shù)屬
20、性來(lái)跟蹤銀 行當(dāng)前有多少客戶(hù)。 a. 創(chuàng)建 Bank 類(lèi) b. 為 Bank 類(lèi) 增 加 兩 個(gè) 屬 性 : customers(Customer對(duì)象的數(shù)組 ) 和 numberOfCustomers(整數(shù),跟蹤下一個(gè) customers 數(shù)組索引) c. 添加公有構(gòu)造器,以合適的最大尺寸(至少大于 5)初始化 customers 數(shù)組。 d. 添加 addCustomer 方法。該方法必須依照參數(shù)(姓,名)構(gòu)造一個(gè)新的 Customer 對(duì)象然后把它放到 customer 數(shù)組中。還必須把 numberofCustomers 屬性的值加 1。
21、 e. 添加 getNumOfCustomers 訪(fǎng)問(wèn)方法,它返回 numberofCustomers 屬性值。 f. 添加 getCustomer方法。它返回與給出的index參數(shù)相關(guān)的客戶(hù)。 g. 編譯并運(yùn)行 TestBanking 程序。可以看到下列輸出結(jié)果: Customer 1 is Simms,Jane Customer 2 is Bryant,Owen Customer 3 is Soley,Tim Customer 4 is Soley,Maria /TestBanking.java 文件/*
22、60;* This class creates the program to test the banking classes. * It creates a new Bank, sets the Customer (with an initial balance), * and performs a series of transactions with the Account object. */import banking.*;public class TestBanking public static void main(String arg
23、s) Bank bank = new Bank(); / Add Customer Jane, Simms/code /Add Customer Owen, Bryant/code / Add Customer Tim, Soley/code / Add Customer Maria, Soley/code for ( int i = 0; i < bank.getNumOfCustomers(); i+
24、 ) Customer customer = bank.getCustomer(i); System.out.println("Customer " + (i+1) + " is "+ customer.getLastName()+ ", " + customer.getFirstName(); Java 基礎(chǔ)實(shí)戰(zhàn)Bank 項(xiàng)目 實(shí)驗(yàn)題目 5: 在銀行項(xiàng)目中創(chuàng)建 Account 的兩
25、個(gè)子類(lèi):SavingAccount 和 CheckingAccount 實(shí)驗(yàn)?zāi)康模?#160;繼承、多態(tài)、方法的重寫(xiě)。 提 示: 創(chuàng)建 Account 類(lèi)的兩個(gè)子類(lèi):SavingAccount 和 CheckingAccount 子類(lèi) a. 修改 Account 類(lèi);將 balance 屬性的訪(fǎng)問(wèn)方式改為 protected b. 創(chuàng)建 SavingAccount 類(lèi),該類(lèi)繼承 Account 類(lèi) c. 該類(lèi)必須包含一個(gè)類(lèi)型為 double 的 interestRate 屬性 d. 該類(lèi)必須包括帶有兩個(gè)參數(shù)(balance
26、和 interest_rate)的公有構(gòu)造器。該構(gòu) 造器必須通過(guò)調(diào)用 super(balance)將 balance 參數(shù)傳遞給父類(lèi)構(gòu)造器。 實(shí)現(xiàn) CheckingAccount 類(lèi) 1 CheckingAccount 類(lèi)必須擴(kuò)展 Account 類(lèi) 2 該類(lèi)必須包含一個(gè)類(lèi)型為 double 的 overdraftProtection 屬性。 3 該類(lèi)必須包含一個(gè)帶有參數(shù)(balance)的共有構(gòu)造器。該構(gòu)造器必須通過(guò)調(diào) 用 super(balance)將 balance 參數(shù)傳遞給父類(lèi)構(gòu)造器。 4 給類(lèi)必須包括另一個(gè)帶有兩個(gè)參數(shù)(balanc
27、e 和 protect)的公有構(gòu)造器。該 構(gòu)造器必須通過(guò)調(diào)用 super(balance)并設(shè)置 overdragtProtection 屬性,將 balance 參數(shù)傳遞給父類(lèi)構(gòu)造器。 5 CheckingAccount 類(lèi)必須覆蓋 withdraw 方法。此方法必須執(zhí)行下列檢查。如 果當(dāng)前余額足夠彌補(bǔ)取款 amount,則正常進(jìn)行。如果不夠彌補(bǔ)但是存在透支 保護(hù),則嘗試用 overdraftProtection 得值來(lái)彌補(bǔ)該差值(balance-amount). 如果彌補(bǔ)該透支所需要的金額大于當(dāng)前的保護(hù)級(jí)別。則整個(gè)交易失敗,但余 額未受影響。 6 在主 exercise
28、1 目錄中,編譯并執(zhí)行 TestBanking 程序。輸出應(yīng)為: Creating the customer Jane Smith.Creating her Savings Account with a 500.00 balance and 3% interest.Creating the customer Owen Bryant.Creating his Checking Account with a 500.00 balance and no overdraft protection.Creating the customer Tim Soley.Creating his Che
29、cking Account with a 500.00 balance and 500.00 in overdraft protection.Creating the customer Maria Soley.Maria shares her Checking Account with her husband Tim.Retrieving the customer Jane Smith with her savings account.Withdraw 150.00: trueDeposit 22.50: trueWithdraw 47.62: trueWithdraw 400.00: fal
30、seCustomer Simms, Jane has a balance of 324.88Retrieving the customer Owen Bryant with his checking account with no overdraft protection.Withdraw 150.00: trueDeposit 22.50: trueWithdraw 47.62: trueWithdraw 400.00: falseCustomer Bryant, Owen has a balance of 324.88Retrieving the customer Tim Soley wi
31、th his checking account that has overdraft protection.Withdraw 150.00: trueDeposit 22.50: trueWithdraw 47.62: trueWithdraw 400.00: trueCustomer Soley, Tim has a balance of 0.0Retrieving the customer Maria Soley with her joint checking account with husband Tim.Deposit 150.00: trueWithdraw 750.00: fal
32、seCustomer Soley, Maria has a balance of 150.0/TestBanking 程序/* * This class creates the program to test the banking classes. * It creates a new Bank, sets the Customer (with an initial balance), * and performs a series of transactions with the Account object. */import banking.*;
33、public class TestBanking public static void main(String args) Bank bank = new Bank(); Customer customer; Account account; / / Create bank customers and their accounts / System.out.println
34、("Creating the customer Jane Smith."); bank.addCustomer("Jane", "Simms"); /code System.out.println("Creating her Savings Account with a 500.00 balance and 3% interest."); /code System.out.println
35、("Creating the customer Owen Bryant."); /code customer = bank.getCustomer(1); System.out.println("Creating his Checking Account with a 500.00 balance and no overdraft protection."); /code System.out.println("Cr
36、eating the customer Tim Soley."); bank.addCustomer("Tim", "Soley"); customer = bank.getCustomer(2); System.out.println("Creating his Checking Account with a 500.00 balance and 500.00 in overdraft protection."); /c
37、ode System.out.println("Creating the customer Maria Soley."); /code customer = bank.getCustomer(3); System.out.println("Maria shares her Checking Account with her husband Tim."); customer.setAccount(bank.getCustomer
38、(2).getAccount(); System.out.println(); / / Demonstrate behavior of various account types / / Test a standard Savings Account System.out.println("Retrieving the customer Jane Smith with her savings account.");
39、60; customer = bank.getCustomer(0); account = customer.getAccount(); / Perform some account transactions System.out.println("Withdraw 150.00: " + account.withdraw(150.00); System.out.println("Deposit 22.50: " + account.de
40、posit(22.50); System.out.println("Withdraw 47.62: " + account.withdraw(47.62); System.out.println("Withdraw 400.00: " + account.withdraw(400.00); / Print out the final account balance System.out.println("Customer " + c
41、ustomer.getLastName() + ", " + customer.getFirstName() + " has a balance of " + account.getBalance(); System.out.println(); / Test a Checking Account w/o overdraft protection System.out.println("R
42、etrieving the customer Owen Bryant with his checking account with no overdraft protection."); customer = bank.getCustomer(1); account = customer.getAccount(); / Perform some account transactions System.out.println("Withdraw 150.00: "
43、 + account.withdraw(150.00); System.out.println("Deposit 22.50: " + account.deposit(22.50); System.out.println("Withdraw 47.62: " + account.withdraw(47.62); System.out.println("Withdraw 400.00: " + account.withdraw(400.00); &
44、#160; / Print out the final account balance System.out.println("Customer " + customer.getLastName() + ", " + customer.getFirstName() + " has a balance of " + account.getBalance(); System.out.println();
45、60; / Test a Checking Account with overdraft protection System.out.println("Retrieving the customer Tim Soley with his checking account that has overdraft protection."); customer = bank.getCustomer(2); account = customer.getAccount();
46、60; / Perform some account transactions System.out.println("Withdraw 150.00: " + account.withdraw(150.00); System.out.println("Deposit 22.50: " + account.deposit(22.50); System.out.println("Withdraw 47.62: " + account.withdraw(47.6
47、2); System.out.println("Withdraw 400.00: " + account.withdraw(400.00); / Print out the final account balance System.out.println("Customer " + customer.getLastName() + ", " + customer.getFirstName()
48、 + " has a balance of " + account.getBalance(); System.out.println(); / Test a Checking Account with overdraft protection System.out.println("Retrieving the customer Maria Soley with her joint checking account with husband Tim.");
49、; customer = bank.getCustomer(3); account = customer.getAccount(); / Perform some account transactions System.out.println("Deposit 150.00: " + account.deposit(150.00); System.out.println("Withdraw 750.00: " + account.with
50、draw(750.00); / Print out the final account balance System.out.println("Customer " + customer.getLastName() + ", " + customer.getFirstName() + " has a balance of " + account.getBalance(); 實(shí)驗(yàn)題目
51、:5_續(xù)1創(chuàng)建客戶(hù)賬戶(hù)實(shí)驗(yàn)?zāi)康模篿nstanceof 運(yùn)算符的應(yīng)用提示:修改Customer類(lèi)1 修改Customer類(lèi)來(lái)處理具有多種類(lèi)型的聯(lián)合賬戶(hù)。(例如用數(shù)組表示多重性一節(jié)所作的,該類(lèi)必須包括以下的公有方法:addAccount(Account),getAccount(int)和getNumOfAccounts()。每個(gè)Customer可以有多個(gè)Account。(聲明至少有5個(gè))2 完成TestBanking程序該程序創(chuàng)建一個(gè)客戶(hù)和賬戶(hù)的集合,并生成這些客戶(hù)及其賬戶(hù)余額的報(bào)告。在TestBanking.Java文件中,你會(huì)發(fā)現(xiàn)注釋塊以/*/來(lái)開(kāi)頭和結(jié)尾。這些注釋只是必須提供的代碼的位置。3
52、 使用instanceof操作符測(cè)試擁有的賬戶(hù)類(lèi)型,并且將account_type設(shè)置為適當(dāng)?shù)闹担纾骸癝avingsAccount”或“CheckingAccount”。4 編譯并運(yùn)行該程序,將看到下列結(jié)果CUSTOMERS REPORT=Customer: Simms, JaneSavings Account: current balance is ¥500.00Checking Account: current balance is ¥200.00Customer: Bryant, OwenChecking Account: current balance is ¥200.00Cust
53、omer: Soley, TimSavings Account: current balance is ¥1,500.00Checking Account: current balance is ¥200.00Customer: Soley, MariaChecking Account: current balance is ¥200.00Savings Account: current balance is ¥150.00/TestBanking程序/* * This class creates the program to test the banking classes.
54、60;* It creates a set of customers, with a few accounts each, * and generates a report of current account balances. */import banking.*;import java.text.NumberFormat;public class TestBanking public static void main(String args) NumberFormat currency_format = NumberForma
55、t.getCurrencyInstance(); Bank bank = new Bank(); Customer customer; / Create several customers and their accounts bank.addCustomer("Jane", "Simms"); customer = bank.getCustomer(0); custome
56、r.addAccount(new SavingAccount(500.00, 0.05); customer.addAccount(new CheckingAccount(200.00, 400.00); bank.addCustomer("Owen", "Bryant"); customer = bank.getCustomer(1); customer.addAccount(new CheckingAccount(200.00);
57、160; bank.addCustomer("Tim", "Soley"); customer = bank.getCustomer(2); customer.addAccount(new SavingAccount(1500.00, 0.05); customer.addAccount(new CheckingAccount(200.00); bank.addCustomer("Maria", "Soley")
58、; customer = bank.getCustomer(3); / Maria and Tim have a shared checking account customer.addAccount(bank.getCustomer(2).getAccount(1); customer.addAccount(new SavingAccount(150.00, 0.05); / Generate a report System.out.pr
59、intln("tttCUSTOMERS REPORT"); System.out.println("ttt="); for ( int cust_idx = 0; cust_idx < bank.getNumOfCustomers(); cust_idx+ ) customer = bank.getCustomer(cust_idx); System.out.println();
60、; System.out.println("Customer: "+ customer.getLastName() + ", "+ customer.getFirstName(); for ( int acct_idx = 0; acct_idx < customer.getNumOfAccounts(); acct_idx+ ) Account account = customer.getAccount(acct_idx);String account_type = ""/
61、Determine the account type/* Step 1:* Use the instanceof operator to test what type of account* we have and set account_type to an appropriate value, such* as "Savings Account" or "Checking Account".*/ Print the current balance of the account/* Step 2:* Print out the type of acco
62、unt and the balance.* Feel free to use the currency_format formatter* to generate a "currency string" for the balance.*/ 實(shí)驗(yàn)題目:5_續(xù)2 實(shí)現(xiàn)更為復(fù)雜的透支保護(hù)機(jī)制注釋-這是練習(xí)1的選擇練習(xí)。它包括了更為復(fù)雜的透支保護(hù)機(jī)制模型。它使用客戶(hù)儲(chǔ)蓄。它使用客戶(hù)儲(chǔ)蓄賬戶(hù)完成透支保護(hù)。本練習(xí)必須在完成上述兩個(gè)練習(xí)后進(jìn)行。實(shí)驗(yàn)?zāi)康模豪^承、多態(tài)、方法的
63、重寫(xiě)。說(shuō)明:修改SavingAccount類(lèi)1.仿照練習(xí)1“Account類(lèi)的兩個(gè)子類(lèi)”一節(jié)實(shí)現(xiàn)SavingsAccount類(lèi)。2.SavingAccount類(lèi)必須擴(kuò)展Account類(lèi)。3.該類(lèi)必須包含一個(gè)類(lèi)型為double的interestRate屬性4.該類(lèi)必須包括一個(gè)帶有兩個(gè)參數(shù)(balance和interest_rate)的公有構(gòu)造器。該構(gòu)造器必須通過(guò)調(diào)用super(balance)來(lái)將balance參數(shù)傳遞給父類(lèi)構(gòu)造器修改CheckingAccount類(lèi)1.仿照練習(xí)1“Account類(lèi)的兩個(gè)子類(lèi)”一節(jié)實(shí)現(xiàn)CheckingAccount類(lèi)。2.CheckingAccount類(lèi)必須擴(kuò)展A
64、ccount類(lèi)3.該類(lèi)必須包括一個(gè)關(guān)聯(lián)屬性,稱(chēng)作protectedBy,表示透支保護(hù)。該屬性的類(lèi)型為SavingAccount,缺省值必須是null。除此之外該類(lèi)沒(méi)有其他的數(shù)據(jù)屬性。4.該類(lèi)必須包括一個(gè)帶有參數(shù)(balance)的公有構(gòu)造器,該構(gòu)造器必須通過(guò)調(diào)用super(balance)將balance參數(shù)傳遞到父類(lèi)構(gòu)造器。5.修改構(gòu)造器為CheckingAccount(double balance,SavingAccount protect)構(gòu)造器。該構(gòu)造器必須通過(guò)調(diào)用super(balance)將balance參數(shù)傳遞給父類(lèi)構(gòu)造器。6. CheckingAccount類(lèi)必須覆蓋withd
65、raw方法。該類(lèi)必須執(zhí)行下面的檢查:如果當(dāng)前余額足夠彌補(bǔ)取款amount,則正常進(jìn)行。如果不夠彌補(bǔ)但是存在透支保護(hù)則嘗試用儲(chǔ)蓄賬戶(hù)來(lái)彌補(bǔ)這個(gè)差值(balance-amount)。如果后一個(gè)交易失敗,則整個(gè)交易一定失敗,但余額未受影響。修改Customer類(lèi),使其擁有兩個(gè)賬戶(hù):一個(gè)儲(chǔ)蓄賬戶(hù)和一個(gè)支票賬戶(hù):兩個(gè)都是可選的。1.在練習(xí)5_續(xù)1修改,原來(lái)的Customer類(lèi)包含一個(gè)稱(chēng)作account的關(guān)聯(lián)屬性,可用該屬性控制一個(gè)Account對(duì)象。重寫(xiě)這個(gè)類(lèi),使其包含兩個(gè)關(guān)聯(lián)屬性:savingAccount和checkingAccount,這兩個(gè)屬性的缺省值是null2.包含兩個(gè)訪(fǎng)問(wèn)方法:getSav
66、ing和getChecking,這兩個(gè)方法分別返回儲(chǔ)蓄和支票總數(shù)。3. 包含兩個(gè)相反的方法:SetSaving和setChecking,這兩個(gè)方法分別為savingAccount和checkingAccount這兩個(gè)關(guān)聯(lián)屬性賦值。完成TestBanking程序Customer Simms, Jane has a checking balance of 200.0 and a savings balance of500.0Checking Acct Jane Simms : withdraw 150.00 succeeds? trueChecking Acct Jane Simms : deposit 22.
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年安全管理員安全培訓(xùn)考試試題可打印
- 2025新版車(chē)間安全培訓(xùn)考試試題及完整答案(必刷)
- 2025管理人員安全培訓(xùn)考試試題及參考答案(精練)
- 2025合同糾紛解決的關(guān)鍵要素
- 2025購(gòu)銷(xiāo)合同轉(zhuǎn)讓協(xié)議范本
- 2025私營(yíng)企業(yè)員工的人事合同范本
- 2025房產(chǎn)買(mǎi)賣(mài)合同書(shū)
- 2025年電子線(xiàn)圈設(shè)備項(xiàng)目建議書(shū)
- 2025標(biāo)準(zhǔn)版汽車(chē)銷(xiāo)售合同協(xié)議書(shū)
- 2025建筑公司標(biāo)準(zhǔn)版勞動(dòng)合同
- 臨時(shí)聘用司機(jī)合同范本
- Q∕GDW 12165-2021 高海拔地區(qū)運(yùn)維檢修裝備配置規(guī)范
- 現(xiàn)代風(fēng)險(xiǎn)導(dǎo)向?qū)徲?jì)在天衡會(huì)計(jì)師事務(wù)所的應(yīng)用研究
- JGJ107-2016鋼筋機(jī)械連接技術(shù)規(guī)程
- 婦科醫(yī)生進(jìn)修匯報(bào)課件
- 動(dòng)態(tài)分析與設(shè)計(jì)實(shí)驗(yàn)報(bào)告總結(jié)
- 2024年江蘇省泰州市海陵區(qū)中考一模數(shù)學(xué)試卷
- 從汽車(chē)檢測(cè)看低空飛行器檢測(cè)發(fā)展趨勢(shì)
- DB32T 4740-2024 耕地和林地?fù)p害程度鑒定規(guī)范
- 五一節(jié)假日安全生產(chǎn)培訓(xùn)
- 中考英語(yǔ)二輪復(fù)習(xí)課件:中考解題技巧-讀寫(xiě)綜合
評(píng)論
0/150
提交評(píng)論