Welcome to ICSE Java Answers. Ask any questions you have related to Java and we will answer them.
Java is a registered trademark of Oracle. This site is in no way related to or endorsed by Oracle.

to design a bank account

0 votes
Write a java program that uses class member and instance member to manipulate different bank account,initial amount is Rs 25000 and in othr type the initial amount is Rs 45000.Use a class field to keep count of number of account open.common rate of interest is 8.75% p.a. The interest is to be calculatedfor 1 year and then balance s to be updated
asked by dipesh (83 points)

1 Answer

0 votes
 
Best answer
//intrest to be calculated for a year
import java.io.*;
public class member
{   
    public static void main(String args[])throws IOException
    {
        InputStreamReader input=new InputStreamReader(System.in);
        BufferedReader br=new BufferedReader(input);
        System.out.println("Enter the number of accounts");
        int acc=Integer.parseInt(br.readLine());
        String name[]=new String[acc];
        long acc_no[]=new long[acc];
        int initial[]=new int[acc];
        String acc_type[]=new String[acc];
        double amount[]=new double[acc];
        int count=0;
        for(int i=0;i<acc;i++)
        {
            System.out.println("Enter account holder's name");
            name[i]=br.readLine();
            System.out.println("Enter account number");
            acc_no[i]=Long.parseLong(br.readLine());
            System.out.println("Enter initial amount in account");
            initial[i]=Integer.parseInt(br.readLine());
            System.out.println("Enter type of account");
            acc_type[i]=br.readLine();
            System.out.println("Enter amount in account");
            amount[i]=Double.parseDouble(br.readLine());
        }
        for(int i=0;i<acc;i++)
        {
            if(initial[i]==25000)
            count++;
        }
        System.out.println("No of Rs 25000 account= "+count);
        System.out.println("NAME\t\t ACCOUNT NUMBER\t ACCOUNT TYPE\t BALANCE\t INTREST\t NEW BALANCE");
        for(int i=0;i<acc;i++)
        {
            double intrest=amount[i]*0.0875;
            double new_amm=amount[i]+intrest;
            if(initial[i]==25000)
            System.out.println(name[i]+"\t\t "+acc_no[i]+"\t\t"+acc_type[i]+"\t\t"+amount[i]+"\t\t"+intrest+"\t\t"+new_amm);
        }
        System.out.println("No of Rs 45000 account= "+(acc-count));
        System.out.println("NAME\t\t ACCOUNT NUMBER\t ACCOUNT TYPE\t BALANCE\t INTREST\t NEW BALANCE");
        for(int i=0;i<acc;i++)
        {
            double intrest=amount[i]*0.0875;
            double new_amm=amount[i]+intrest;
            if(initial[i]==45000)
            System.out.println(name[i]+"\t\t "+acc_no[i]+"\t\t"+acc_type[i]+"\t\t"+amount[i]+"\t\t"+intrest+"\t\t"+new_amm);
        }
    }
}
answered by dipesh (83 points)
...