QuestionQuestion

Write a class with methods to help you balance your checking account (an object class-main method is not in this class). The CheckingAccount Class should have at least two instance variables: the balance and the total service charges, along with methods to get and set each instance variable. You may add other variables and methods if you like. The program should read the initial balance for the month, followed by a series of transactions. For each transaction entered, the program should display the transaction data, the current balance for the account, and the total service charges.

Service charges are $0.10 for a deposit and $0.15 for a check. If a check forces the balance to drop below $500.00 at any point during the month, a service charge of $5.00 is assessed but only for the first time this happens. Anytime the balance drops below $50.00, the program should print a warning message. If a check results in a negative balance, an additional service charge of $10.00 should be assessed. A transaction takes the form of an int number (the transaction code), followed by a double number (the transaction amount). If the int number is a 1, then the double number is the amount of a check. If the int number is 2, then the double number is the amount of a deposit. The last transaction is 0 with no number to follow it. Use the JOptionPane to produce the dialog.

Use proper style and indentation, efficient programming techniques and meaningful variable and method names according to Java conventions.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

package assignment.pkg2;

import java.awt.HeadlessException;
import java.text.NumberFormat;
import java.util.Locale;
import javax.swing.JOptionPane;

public class Main
{
    //global variables
    //define a CheckingAccount object to keep trach of the
    //account information
    // public static double initialBalance, transactionAmount;
// public static int transactionCode;
    private static boolean firstTime = true;   
    private static CheckingAccount C ;
    // format the currentcy
    private static NumberFormat formatter = NumberFormat.getCurrencyInstance(Locale.US);
   
    public static void main(String[] args)
    {
       String initialBal;
       //defines local variables
       int transactionCode;      
       double initialBalance;
       double transactionAmount;
      
       //get initial balance from the user
       //perform in a loop until the transaction code = 0
       //get the transaction code from the user
       //and process it with appropriate helper method
       //When loop ends show final balance to user
            
       // The program should read the initial balance for the month,
       // followed by a series of transactions.
       initialBal = JOptionPane.showInputDialog("Enter your initial balance: ");
       initialBalance = Double.parseDouble(initialBal);
      
       C = new CheckingAccount(initialBalance);...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

50% discount

Hours
Minutes
Seconds
$25.00 $12.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats