Question

In: Computer Science

please with java and in JOptionPane if possible .bank charges 10.00 per month plus the following...

please with java and in JOptionPane if possible

.bank charges 10.00 per month plus the following fees for a checking account:
    .10 each for less than 20 checks
   . 08 each for 20 – 39 checks
    .06 each for 40 – 59 checks
    .04 each for 60 or more checks
The bank also charges an extra 15.00 if the balance of the account falls below $400 (before any check fees are applied).
Write a program that reads the following:
The account number ( a String )
The beginning balance of an account
The number of checks written
The total amount of the checks
The program should subtract the total amount of the checks from the balance; it should calculate the bank fees (all that apply); and it should print an “end of month statement” which includes the following:
   The account number
   The beginning balance
   The total amount of the checks
   The total charges
   The final balance   -- if the final balance is negative, print a warning

Solutions

Expert Solution

Here is the code to the given problem.I have taken inputs from user and printed end of month statement using JOptionPane as asked.As per the question, only check amount needs to be deducted from balance, so bank charges are not deducted from balance.

Code:



import javax.swing.*;

public class Bank {

    public static void main(String[] args){

        double initialBalance,finalBalance,checksAmount=0,bankCharges=10;

        int numOfChecks;

        String accountNumber;
        
        accountNumber= JOptionPane.showInputDialog("Enter account number :");    //prompts the user to enter account number

        initialBalance=Double.parseDouble(JOptionPane.showInputDialog("Enter beginning balance:"));   //prompts the user to enter beginning balance

        numOfChecks=Integer.parseInt(JOptionPane.showInputDialog("Enter the total number of checks written:"));  //prompts the user to enter number of checks

        checksAmount=Double.parseDouble(JOptionPane.showInputDialog("Enter the total amount of checks :"));  //prompts the user to enter the total amount of checks

        if(initialBalance<400)       //checks if initial balance is less tha $400
        {
            bankCharges+=15;     //increments bankCharges by $15
        }

        if(numOfChecks<20)   //checks if the number of checks is less than 20
        {
            bankCharges+=numOfChecks*0.10;    //calculates check fees and increment bankCharges
        }
        else if(numOfChecks>=20 && numOfChecks<=39)      //checks if there are 20-39 checks
        {
            bankCharges+=numOfChecks*0.08;   //calculates check fees and increment bankCharges
        }
        else if(numOfChecks>=40 && numOfChecks<=59)      //checks if there are 40-59 checks
        {
            bankCharges+=numOfChecks*0.06;     //calculates check fees and increment bankCharges
        }
        else if(numOfChecks>=60)      //checks if number of checks is greater than 60
        {
            bankCharges+=numOfChecks*0.04;   //calculates check fees and increment bankCharges
        }

        finalBalance=initialBalance-checksAmount;   //calculates final balance by subtracting check amount from initial balance

        JOptionPane.showMessageDialog(null,"END OF MONTH STATEMENT \n"+
                "Account number : "+accountNumber+
                "\nBeginning Balance : $"+initialBalance+
                 "\nTotal Amount of checks : $"+checksAmount+
                 "\nTotal charges : $"+String.format("%.2f",bankCharges)+
                 "\nFinal Balance : $"+String.format("%.2f",finalBalance)+
                (finalBalance<0?"\nWARNING! You have negative balance":""));   //prints end of month statement in a message dialog


    }
}

Sample output:


Related Solutions

Westside Energy charges its electric customers a base rate of $4.00 per month, plus 12¢ per...
Westside Energy charges its electric customers a base rate of $4.00 per month, plus 12¢ per kilowatt-hour (kWh) for the first 300 kWh used and 3¢ per kWh for all usage over 300 kWh. Suppose a customer uses x kWh of electricity in one month. (a) Express the monthly cost E as a piecewise defined function of x. (Assume E is measured in dollars.) E(x) = A.  if 0 ≤ x ≤ 300 B.  if 300 < x C. (b) Graph the...
// the language is java, please implement the JOptionPane Use method overloading to code an operation...
// the language is java, please implement the JOptionPane Use method overloading to code an operation class called CircularComputing in which there are 3 overloaded methods and an output method as follows: • computeObject(double radius) – compute the area of a circle • computeObject(double radius, double height) – compute area of a cylinder • computeObject(double radiusOutside, double radiusInside, double height) – compute the volume of a cylindrical object • output() use of JOptionPane to display instance field(s) and the result...
If possible, please explain how to calculate with a Ti-84 Plus calculator. In the following problem,...
If possible, please explain how to calculate with a Ti-84 Plus calculator. In the following problem, check that it is appropriate to use the normal approximation to the binomial. Then use the normal distribution to estimate the requested probabilities. Do you try to pad an insurance claim to cover your deductible? About 44% of all U.S. adults will try to pad their insurance claims! Suppose that you are the director of an insurance adjustment office. Your office has just received...
A security will make payments of $25 per month, plus $1000 at maturity. The price of...
A security will make payments of $25 per month, plus $1000 at maturity. The price of this security is $2000. Which of the following is true? If the time to maturity is 7 years then the effective rate is 10.52%% If the time to maturity is 4 years then the effective rate is 10.52% If the time to maturity is 7 years then the effective rate is 10.05% If the time to maturity is 4 years then the yield to...
JAVA, this is practice to better understand java. //Please note throughout if possible looking to better...
JAVA, this is practice to better understand java. //Please note throughout if possible looking to better understand the process. Write the following class: Person. Define Class Person Write the class header Class Variables Class Person is to have the following data members: firstName of type String, lastName of type String representing a person’s first and last names and ssn of type int representing a social security number. Each data member has an access specifier of type private. Constructors Class Person...
JAVA, this is practice to better understand java. //Please note throughout if possible looking to better...
JAVA, this is practice to better understand java. //Please note throughout if possible looking to better understand the process. Write the following class: TV. Define Class TV Write the class header Class Variables Class TV is to have the following instance variables: 1.channel of type int 2. volumeLevel of type int 3. isOn of type boolean Each data member is to have an access specifier of private. Constructor Class TV is to have a single, no-arg constructor that initializes the...
How to do this in ti84 plus calculator in shortest possible way The annual per capita...
How to do this in ti84 plus calculator in shortest possible way The annual per capita consumption of bottled water was 32.8 gallons. Assume that the per capita consumption of bottled water is approximately normally distributed with a mean of 32.8 and a standard deviation of 10 gallons. a. What is the probability that someone consumed more than 43 gallons of bottled​ water? b. What is the probability that someone consumed between 30 and 40 gallons of bottled​ water? c....
BuBu Gump has a cost function for overhead costs of $60,000 per month plus $50 per...
BuBu Gump has a cost function for overhead costs of $60,000 per month plus $50 per client hour. In March its overhead allocation rate was calculated assuming 3,000 client hours. Actual overhead costs for July were $220,000, and client hours amounted to 2,800. A.  Determine the total cost for Job 526 if direct costs were $52,000 and 850 hours were worked for the client. B.  Provide examples of possible overhead costs for BuBu Gump that are (1) fixed and (2) variable. C.  Determine...
The Circus Company's bank statement for the month of April showed a balance per bank of...
The Circus Company's bank statement for the month of April showed a balance per bank of $7,000. The company's Cash account in the accounting records had a balance of $5,659 at April 30. Other information is as follows:  Cash receipts for April 30 recorded on the company's books were $6,000 but this amount does not appear on the bank statement.  The bank statement shows a debit memorandum for $40 for check printing charges.  Check No. 119 payable...
JAVA, trying to better learn and use JAVA //Please note throughout if possible looking to better...
JAVA, trying to better learn and use JAVA //Please note throughout if possible looking to better understand the process. Write the following class: Box Define Class Box Write the class header Class Variables Class Box is to have the following private data members: height of type double width of type double length of type double Constructors Class Box is to have two constructors with the following specifications: a no-arg constructor that initializes each double data member to zero a constructor...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT