Assignment task

Write a java console application that calculates and displays the bank interest for N bank accounts. N should be declared as a constant and it should be equal to the largest digit of your student ID number (e.g. if your ID number is S334261 then N should be equal to 6 and you can declare it as final int N=6). The interest is based on total amount in account as shown below in Table 1.

Table 1. Amount and Interest

Amount, Interest
$0 - $1000, 0% (no interest)
$1001 - $5000, 2.5%
$5001- $10000, 5%
Over $10000, 8% (high interest)

The application should ask the user to enter the amount for each account (total N accounts) and calculate the interest. The application should display the interest for each bank account as shown in the example below. At the end of the Nth accounts interest, the details such as total interest, lowest interest, highest interest, average interest and number of accounts with no interest should be displayed. The total interest is calculated by adding the interest for all accounts. The lowest interest is calculated by finding the lowest value from interests for N accounts. The highest interest is calculated by finding the highest value from interests for N accounts. The average interest is calculated by dividing the total interest with the total number of accounts. The number of accounts with no interest is calculated by finding all accounts with zero interest.

Example for N=4

Enter the amount for account number 1: 500
The interest for account number 1 is $0

Enter the amount for account number 2: 2000
The interest for account number 2 is $50

Enter the amount for account number 3: 10000
The interest for account number 3 is $500

Enter the amount for account number 4: 12000
The interest for account number 4 is $960

---------------------Interest Details------------------------
Total Interest: $1510
Lowest Interest: $0
Highest Interest: $960
Average Interest: $377.5
Number of accounts with no interest: 1
-------------------------------------------------------------

Your application is to follow the same format for input and output as in the example above, but with customised welcome and exit messages.

The application is to use the following classes.

public class Account
{
public Account()
{
// constructor
}
public double interest(int amount)
{
// code to calculate interest goes here
}
public int interestType(int interest)
{
// code to determine accounts with no interest goes here
}
}

public class AccountTest
{
public static void main(String[] args)
{
// local variable declarations go here
// display welcome message
// loop to input amount, calculate and display interest, calculate summary values
// generate and display summary
// display exit message
}
}
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.