<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Directory%3ADerek_Elder%2FPrograms%2FCheckingAccount1</id>
	<title>Directory:Derek Elder/Programs/CheckingAccount1 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Directory%3ADerek_Elder%2FPrograms%2FCheckingAccount1"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Directory:Derek_Elder/Programs/CheckingAccount1&amp;action=history"/>
	<updated>2026-06-15T19:30:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Directory:Derek_Elder/Programs/CheckingAccount1&amp;diff=70921&amp;oldid=prev</id>
		<title>Derek Elder: Start of page</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Directory:Derek_Elder/Programs/CheckingAccount1&amp;diff=70921&amp;oldid=prev"/>
		<updated>2008-10-04T00:23:48Z</updated>

		<summary type="html">&lt;p&gt;Start of page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__TOC__&lt;br /&gt;
==CheckingAccount.java==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//*******************************************************************&lt;br /&gt;
//  CheckingAccount Class       Author: Derek Elder&lt;br /&gt;
//********************************************************************&lt;br /&gt;
public class CheckingAccount&lt;br /&gt;
{&lt;br /&gt;
	private double balance;&lt;br /&gt;
	private double totalServiceCharge;&lt;br /&gt;
 &lt;br /&gt;
	public double getBalance()&lt;br /&gt;
	{&lt;br /&gt;
		return balance;&lt;br /&gt;
	}&lt;br /&gt;
	public double setBalance(double currentBalance, double tCode)&lt;br /&gt;
	{&lt;br /&gt;
            if(tCode == 1 || tCode == 0)&lt;br /&gt;
		balance -= currentBalance;&lt;br /&gt;
            else //if(tCode == 2)&lt;br /&gt;
                balance += currentBalance;&lt;br /&gt;
            return balance;&lt;br /&gt;
	}&lt;br /&gt;
	public double getServiceCharge()&lt;br /&gt;
	{&lt;br /&gt;
		return totalServiceCharge;&lt;br /&gt;
	}&lt;br /&gt;
        public double setServiceCharge(double currentServiceCharge)&lt;br /&gt;
	{&lt;br /&gt;
		totalServiceCharge += currentServiceCharge;&lt;br /&gt;
                return totalServiceCharge;&lt;br /&gt;
	}&lt;br /&gt;
	public CheckingAccount(double currentBalance, double currentServiceCharge)&lt;br /&gt;
	{&lt;br /&gt;
		balance = currentBalance;&lt;br /&gt;
		totalServiceCharge = currentServiceCharge;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Main.java==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//*******************************************************************&lt;br /&gt;
//  Program 1       Author: Derek Elder&lt;br /&gt;
//********************************************************************&lt;br /&gt;
&lt;br /&gt;
import javax.swing.JOptionPane;&lt;br /&gt;
import java.text.DecimalFormat;&lt;br /&gt;
&lt;br /&gt;
public class Main&lt;br /&gt;
{&lt;br /&gt;
    public static void main(String[] args)&lt;br /&gt;
    {&lt;br /&gt;
        int tCode = 0;&lt;br /&gt;
	String stringBalance, stringTCode, stringTransAmt, message;&lt;br /&gt;
        double balance, transAmt, charge, balanceBeforeCharge;&lt;br /&gt;
        boolean done = false;&lt;br /&gt;
	boolean below500 = false;&lt;br /&gt;
        charge = 0.00;&lt;br /&gt;
	stringBalance = JOptionPane.showInputDialog(&amp;quot;Enter your initial balance: &amp;quot;);&lt;br /&gt;
	balance = Double.parseDouble(stringBalance);&lt;br /&gt;
        CheckingAccount account = new CheckingAccount(balance, charge);&lt;br /&gt;
&lt;br /&gt;
        while(!done)&lt;br /&gt;
        {&lt;br /&gt;
            stringTCode = JOptionPane.showInputDialog(&amp;quot;Enter the trans code: &amp;quot;);&lt;br /&gt;
            tCode = Integer.parseInt(stringTCode);&lt;br /&gt;
            DecimalFormat fmt = new DecimalFormat (&amp;quot;0.00&amp;quot;); //Round to two decimal places&lt;br /&gt;
            if(tCode == 1)&lt;br /&gt;
            {&lt;br /&gt;
                stringTransAmt = JOptionPane.showInputDialog(&amp;quot;Enter the trans amount: &amp;quot;);&lt;br /&gt;
                transAmt = Double.parseDouble(stringTransAmt);&lt;br /&gt;
                account.setBalance(transAmt, tCode);&lt;br /&gt;
                if(account.getBalance() &amp;lt; 0.00)&lt;br /&gt;
                {&lt;br /&gt;
                    if(below500 == true)&lt;br /&gt;
                    {&lt;br /&gt;
                        charge = 10.15; //Cost of Check + Below $0 charge&lt;br /&gt;
                        account.setServiceCharge(charge);&lt;br /&gt;
                        message = &amp;quot;Transaction : Check in the amount of $&amp;quot; + fmt.format(transAmt) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Current Balance : $&amp;quot; + fmt.format(account.getBalance()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Service charge : Check -- charge $0.15&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Warning : Balance below $50.00&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Service charge : Below $0 -- charge $10.00&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge());&lt;br /&gt;
                        JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                    }&lt;br /&gt;
                    else&lt;br /&gt;
                    {&lt;br /&gt;
                        charge = 5.15; //Cost of Check + Below $500 charge&lt;br /&gt;
                        account.setServiceCharge(charge);&lt;br /&gt;
                        message = &amp;quot;Transaction : Check in the amount of $&amp;quot; + fmt.format(transAmt) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Current Balance : $&amp;quot; + fmt.format(account.getBalance()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Service charge : Check -- charge $0.15&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Service charge : Below $500.00 -- charge $5.00&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge());&lt;br /&gt;
                        JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                        below500 = true;&lt;br /&gt;
                    }&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else if(account.getBalance() &amp;lt; 500.00 &amp;amp;&amp;amp; below500 == false)&lt;br /&gt;
                {&lt;br /&gt;
                    charge = 5.15; //Cost of Check + Below $500 charge&lt;br /&gt;
                    account.setServiceCharge(charge);&lt;br /&gt;
                    below500 = true;&lt;br /&gt;
                    if(account.getBalance() &amp;lt; 50.00)&lt;br /&gt;
                    {&lt;br /&gt;
                        message = &amp;quot;Transaction : Check in the amount of $&amp;quot; + fmt.format(transAmt) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Current Balance : $&amp;quot; + fmt.format(account.getBalance()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Service charge : Check -- charge $0.15&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Warning : Balance below $50.00&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge());&lt;br /&gt;
                        JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                    }&lt;br /&gt;
                    else&lt;br /&gt;
                    {&lt;br /&gt;
                        message = &amp;quot;Transaction : Check in the amount of $&amp;quot; + fmt.format(transAmt) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Current Balance : $&amp;quot; + fmt.format(account.getBalance()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Service charge : Check -- charge $0.15&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Service charge : Below $500.00 -- charge $5.00&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge());&lt;br /&gt;
                        JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                    }&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    charge = 0.15;&lt;br /&gt;
                    account.setServiceCharge(charge);&lt;br /&gt;
                    if(account.getBalance() &amp;lt; 50.00)&lt;br /&gt;
                    {&lt;br /&gt;
                        message = &amp;quot;Transaction : Check in the amount of $&amp;quot; + fmt.format(transAmt) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Current Balance : $&amp;quot; + fmt.format(account.getBalance()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Service charge : Check -- charge $0.15&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Warning : Balance below $50.00&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge());&lt;br /&gt;
                        JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                    }&lt;br /&gt;
                    else&lt;br /&gt;
                    {&lt;br /&gt;
                        message = &amp;quot;Transaction : Check in the amount of $&amp;quot; + fmt.format(transAmt) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Current Balance : $&amp;quot; + fmt.format(account.getBalance()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Service charge : Check -- charge $0.15&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                                &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge());&lt;br /&gt;
                        JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                    }&lt;br /&gt;
                }&lt;br /&gt;
                done = false;&lt;br /&gt;
            }&lt;br /&gt;
            else if(tCode == 2)&lt;br /&gt;
            {&lt;br /&gt;
                stringTransAmt = JOptionPane.showInputDialog(&amp;quot;Enter the trans amount: &amp;quot;);&lt;br /&gt;
                transAmt = Double.parseDouble(stringTransAmt);&lt;br /&gt;
                charge = 0.10;&lt;br /&gt;
                account.setServiceCharge(charge);&lt;br /&gt;
                account.setBalance(transAmt, tCode);&lt;br /&gt;
                if(account.getBalance() &amp;lt;= 50.00)&lt;br /&gt;
                {&lt;br /&gt;
                    message = &amp;quot;Transaction : Check in the amount of $&amp;quot; + fmt.format(transAmt) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Current Balance : $&amp;quot; + fmt.format(account.getBalance()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Service charge : Deposit -- charge $0.10&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Warning : Balance below $50.00&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge());&lt;br /&gt;
                    JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    message = &amp;quot;Transaction : Deposit in the amount of $&amp;quot; + fmt.format(transAmt) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Current Balance : $&amp;quot; + fmt.format(account.getBalance()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Service charge : Deposit -- charge $0.10&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                            &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge());&lt;br /&gt;
                    JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                }&lt;br /&gt;
                done = false;&lt;br /&gt;
            }&lt;br /&gt;
            else //tCode = 0&lt;br /&gt;
            {&lt;br /&gt;
                balanceBeforeCharge = account.getBalance();&lt;br /&gt;
                charge = account.getServiceCharge();&lt;br /&gt;
                account.setBalance(charge, tCode);&lt;br /&gt;
                message = &amp;quot;Transaction : End&amp;quot; + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                          &amp;quot;Current Balance : $&amp;quot; + fmt.format(balanceBeforeCharge) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                          &amp;quot;Total service charge : $&amp;quot; + fmt.format(account.getServiceCharge()) + &amp;quot;\n&amp;quot; +&lt;br /&gt;
                          &amp;quot;Final Balance : $&amp;quot; + fmt.format(account.getBalance());&lt;br /&gt;
                JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
                done = true;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        message = &amp;quot;End of program.&amp;quot;;&lt;br /&gt;
        JOptionPane.showMessageDialog(null, message);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Derek Elder</name></author>
	</entry>
</feed>