Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

love of humour, often as a device to lighten the occasion;

Answered: 1 week ago

Question

orderliness, patience and seeing a task through;

Answered: 1 week ago

Question

well defined status and roles (class distinctions);

Answered: 1 week ago