📄 transaction.tex.old
字号:
\begin{program}
\PACKAGE\ Accounts;\\
\\[\emptyline]
\textrm{/**}\>\textrm{This class saves the details of a command for monthly statements}\\
\>\textrm{and to permit audits.*/}\\
\PUBLIC\ \CLASS\ Transaction\\
$\{$\\
\>\textrm{/**}\>\textrm{The amount of money involved in the transaction */}\\
\>\FLOAT\ amount;\\
\\[\emptyline]
\>\textrm{/**} \textrm{ The line of credit involved in the transaction */}\\
\>\FLOAT\ lineOfCredit;\\
\\[\emptyline]
\>\textrm{/**}\>\textrm{The date of the transaction */}\\
\>\INT\ date;\\
\\[\emptyline]
\>\textrm{/**}\>\textrm{A description of the transaction */}\\
\>String description;\\
\\[\emptyline]
\>\textrm{/**}\>\textrm{A constructor for a transaction that takes in}\\
\>\>\textrm{a date, description, amount, and line of credit */}\\
\>\PUBLIC\ Transaction(\INT\ d, String des, \FLOAT\ amt, \FLOAT\ loc)\\
\>$\{$\\
\>\>date = d;\\
\>\>description = des;\\
\>\>amount = amt;\\
\>\>lineOfCredit = loc;\\
\>$\}$\\
\\[\emptyline]
\>\textrm{/**}\>\textrm{Return a string representation of the transaction */}\\
\>\PUBLIC\ String toString()\\
\>$\{$\\
\>\>String blanks = " ";\\
\>\>blanks += blanks; \textrm{// now 40 blank spaces}\\
\>\>String result = "$\backslash$n" + date;\\
\>\>result += blanks.substring(0, 10-result.length()) + description;\\
\>\>\IF(lineOfCredit != 0.0)\\
\>\>\>result += lineOfCredit;\\
\>\>result += blanks.substring(0, 45-result.length()) + amount;\\
\>\>\RETURN\ result;\\
\>$\}$\\
$\}$\\
\end{program}
\vspace{\backup}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -