Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!