A bank charges $10.00 per month plus the following check fees for a commercial c
ID: 3628466 • Letter: A
Question
A bank charges $10.00 per month plus the following check fees for acommercial checking account:
$0.10 each for less than 20 checks
$0.08 each for 20– 39 checks
$0.06 each for 40– 59 checks
$0.04 each for 60 or more checks
The bank also charges an extra $15.00 if the balance of the account
falls below $400.00 (before any check fees are applied). Design a
class that stores the beginning balance of an account and the number
of checks written. It should also have a method that returns the
bank’s service fees for the month.
Explanation / Answer
please rate - thanks
you didn't say what language but the term method points towards JAVA
there is nothing about the checks that were written
import java.util.*;
public class Main
{public static void main(String[] args)
{Scanner in=new Scanner(System.in);
double balance,fee;
int num;
System.out.print("Enter beginning balance: ");
balance=in.nextDouble();
System.out.print("Enter number of checks written: ");
num=in.nextInt();
fee=getFee(num,balance);
balance-=fee;
System.out.println("new balance="+balance);
}
public static double getFee(int num,double balance)
{double fee=10,each;
if(balance<400)
fee+=15;
if(num<20)
each=.1;
else if(num<40)
each=.08;
else if(num<60)
each=.06;
else
each=.04;
fee=fee+each*num;
return fee;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.