Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Practice The file BankCharge.java is a working Java application that will allow the user to enter a number of checks written for a bank.

Programming Practice

The file BankCharge.java is a working Java application that will allow the user to enter a number of checks written for a bank. The program is lacking the calculations to find the total bank fees for the checking account. Change the source code to correctly calculate the bank charges using the following algorithm:

A base fee of $10 is charged regardless of the number of checks. Then, the following is added:

10 cents each for less than 30 checks

8 cents each for 30-49 checks

6 cents each for 50-74 checks

4 cents each for 75 or more checks

// This application receives a number of checks written by // a bank customer and calculates the monthly service charge. import javax.swing.JOptionPane; import java.text.DecimalFormat; public class BankCharge { public static void main( String args[] ) { int numChecks; // Input value - checks written double bankCharge; // Output value - bank charges // Set up for monetary decimal formatting DecimalFormat twoDigits = new DecimalFormat( "0.00" ); // Read number of checks from user, convert to integer numChecks = Integer.parseInt( JOptionPane.showInputDialog( "Enter number of checks" )); // Calculate the total bank charge // ==> REPLACE the statement below with the "if" logic required by the specs bankCharge = 0; // Display results JOptionPane.showMessageDialog ( null, "Monthly bank charge: $" + twoDigits.format(bankCharge)); System.exit( 0 ); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago