⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customer.tex.old

📁 国外的数据结构与算法分析用书
💻 OLD
字号:
\begin{program}
\PACKAGE\ People;\\
\IMPORT\ Accounts.Account;\\
\IMPORT\ dslib.list.LinkedListUos;\\
\IMPORT\ dslib.base.DuplicateItemsExceptionUos;\\
\IMPORT\ dslib.base.NoCurrentItemExceptionUos;\\
\IMPORT\ dslib.base.ObjectNotComparableExceptionUos;\\
\\[\emptyline]
\textrm{/**}\>\textrm{A bank customer with a list of accounts. */}\\
\PUBLIC\ \CLASS\ Customer \EXTENDS\ Person\\
$\{$\\
\>\textrm{/**}\>\textrm{A linked list of accounts that belong to this Customer */}\\
\>\PRIVATE\ LinkedListUos accounts;\\
\\[\emptyline]
\>\textrm{/**}\>\textrm{Construct a new Customer from a name */}\\
\>\PUBLIC\ Customer(String n)\\
\>$\{$\\
\>\>\SUPER(n);\\
\>\>accounts = \NEW\ LinkedListUos();\\
\>$\}$\\
\\[\emptyline]
\>\textrm{/**}\>\textrm{Add the Account "a" to the linked list of accounts */}\\
\>\PUBLIC\ \jVOID\ addAccount(Account a)\\
\>$\{$\\
\>\>\TRY\\
\>\>$\{$\\
\>\>\>accounts.insert(a);\\
\>\>$\}$ \CATCH\ (DuplicateItemsExceptionUos e) $\{$$\}$\\
\>\>  \CATCH\ (ObjectNotComparableExceptionUos e) $\{$$\}$\\
\>$\}$\\
\\[\emptyline]
\>\textrm{/**}\>\textrm{Return a string representation of the Customer */}\\
\>\PUBLIC\ String toString()\\
\>$\{$\\
\>\>String temp = "Name: " + name + "$\backslash$n";\\
\>\>accounts.goFirst();\\
\>\>\WHILE\ (!accounts.after())\\
\>\>\>\TRY\\
\>\>\>$\{$\\
\>\>\>\>temp += accounts.item().toString();\\
\>\>\>$\}$ \CATCH\ (NoCurrentItemExceptionUos e) $\{$$\}$\\
\>\>\RETURN\ temp;\\
\>$\}$\\
$\}$\\
\end{program}
\vspace{\backup}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -