Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: compile error in the line bufferedreader.. plz help me how do i compile and run this program

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    My Mood
    Cheerful
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default compile error in the line bufferedreader.. plz help me how do i compile and run this program

    import java.util.*;
    import java.lang.*;
    class Bank
    {
    String name;
    float acc_no,balance;
    void accept(String str, float no, float bal)
    {
    name=str;
    acc_no=no;
    balance=bal;
    }
    public String toString()
    {
    return(name+"\t"+acc_no+"\t"+balance);
    }
    }
    class Withdraw
    {
    String date;
    float acc_no,amount;
    void accept(String str, float no, float amt)
    {
    date=str;
    acc_no=no;
    amount=amt;
    }
    }
    class Deposit
    {
    String date;
    float acc_no,amount;
    void accept(String str, float no, float amt)
    {
    date=str;
    acc_no=no;
    amount=amt;
    }
    }
    abstract class bankaccount
    {
    public static void main(String []args)
    {
    String str,str1;
    BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    Vector bank = new Vector();
    Vector withdraw = new Vector();
    Vector deposit = new Vector();
    int i,choice=0,j=0,k=0,l;
    float bal,no,amt;
    Bank b[]=new Bank[1000];
    Withdraw w[]=new Withdraw[1000];
    Deposit d[]=new Deposit[1000];
    System.out.println("Enter name, account number and balance of 3 account holders:");
    for(i=0;i<=2;i++)
    {
    b[i]=new Bank();
    str1=br.readLine();
    no=Float.parseFloat(br.readLine());
    bal=Float.parseFloat(br.readLine());
    b[i].accept(str1,no,bal);
    bank.addElement(b[i]);
    }
    while(choice!=5)
    {
    System.out.println("1.Add new customer\n2.Withdrawal \n3.Deposit\n4. View Contents\n5. Exit\nEnter your choice:");
    choice=Integer.parseInt(br.readLine());
    switch(choice)
    {
    case 1: System.out.println("Enter name, account number and balance:");
    str1=br.readLine();
    no=Float.parseFloat(br.readLine());
    bal=Float.parseFloat(br.readLine());
    b[i]=new Bank();
    b[i].accept(str1,no,bal);
    bank.addElement(b[i]);
    i++;
    break;
    case 2: System.out.println("Enter account number, amount and date:");
    no=Float.parseFloat(br.readLine());
    amt=Float.parseFloat(br.readLine());
    str1=br.readLine();
    w[j]=new Withdraw();
    w[j].accept(str1,no,amt);
    withdraw.addElement(w[j]);
    j++;
    l=0;
    while(b[l].acc_no!=no)
    {
    l++;
    }
    bank.removeElement(b[l]);
    b[l].balance-=amt;
    bank.addElement(b[l]);
    break;
    case 3: System.out.println("Enter account number, amount and date:");
    no=Float.parseFloat(br.readLine());
    amt=Float.parseFloat(br.readLine());
    str1=br.readLine();
    d[k]=new Deposit();
    d[k].accept(str1,no,amt);
    deposit.addElement(d[k]);
    k++;
    l=0;
    while(b[l].acc_no!=no)
    {
    l++;
    }
    bank.removeElement(b[l]);
    b[l].balance+=amt;
    bank.addElement(b[l]);
    break;
    case 4: for(i=0;i<=bank.size()-1;i++)
    {
    System.out.println(bank.elementAt(i));
    }
    break;
    case 5: break;
    default: System.out.println("Invalid choice");
    }
    }
    }
    }


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: compile error in the line bufferedreader.. plz help me how do i compile and run this program

    Format your code with code tags and post the full error message you get.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: compile error in the line bufferedreader.. plz help me how do i compile and run this program

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    Please post your code using code or highlight tags as explained near the top of the above link.

  4. #4
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    My Mood
    Cheerful
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: compile error in the line bufferedreader.. plz help me how do i compile and run this program


  5. #5
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    My Mood
    Cheerful
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: compile error in the line bufferedreader.. plz help me how do i compile and run this program

    bankaccount.java:45:cannot find symbol
    symbol:class BufferedReader
    location:class bankaccount
    BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    ^
    bankaccount.java:45:cannot find symbol
    symbol:class BufferedReader
    location:class bankaccount
    BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    ^
    bankaccount.java:45:cannot find symbol
    symbol:class InputStreamReader
    location:class bankaccount
    BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    ^
    Note: bankaccount.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    3 errors

    --- Update ---

    import java.util.*;
    import java.lang.*;
    class Bank
    {
    String name;
    float acc_no,balance;
    void accept(String str, float no, float bal)
    {
    name=str;
    acc_no=no;
    balance=bal;
    }
    public String toString()
    {
    return(name+"\t"+acc_no+"\t"+balance);
    }
    }
    class Withdraw
    {
    String date;
    float acc_no,amount;
    void accept(String str, float no, float amt)
    {
    date=str;
    acc_no=no;
    amount=amt;
    }
    }
    class Deposit
    {
    String date;
    float acc_no,amount;
    void accept(String str, float no, float amt)
    {
    date=str;
    acc_no=no;
    amount=amt;
    }
    }
    abstract class bankaccount
    {
    public static void main(String []args)
    {
    String str,str1;
    BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    Vector bank = new Vector();
    Vector withdraw = new Vector();
    Vector deposit = new Vector();
    int i,choice=0,j=0,k=0,l;
    float bal,no,amt;
    Bank b[]=new Bank[1000];
    Withdraw w[]=new Withdraw[1000];
    Deposit d[]=new Deposit[1000];
    System.out.println("Enter name, account number and balance of 3 account holders:");
    for(i=0;i<=2;i++)
    {
    b[i]=new Bank();
    str1=br.readLine();
    no=Float.parseFloat(br.readLine());
    bal=Float.parseFloat(br.readLine());
    b[i].accept(str1,no,bal);
    bank.addElement(b[i]);
    }
    while(choice!=5)
    {
    System.out.println("1.Add new customer\n2.Withdrawal \n3.Deposit\n4. View Contents\n5. Exit\nEnter your choice:");
    choice=Integer.parseInt(br.readLine());
    switch(choice) 
    {
    case 1: System.out.println("Enter name, account number and balance:");
    str1=br.readLine();
    no=Float.parseFloat(br.readLine());
    bal=Float.parseFloat(br.readLine());
    b[i]=new Bank();
    b[i].accept(str1,no,bal);
    bank.addElement(b[i]);
    i++;
    break;
    case 2: System.out.println("Enter account number, amount and date:");
    no=Float.parseFloat(br.readLine());
    amt=Float.parseFloat(br.readLine());
    str1=br.readLine();
    w[j]=new Withdraw();
    w[j].accept(str1,no,amt);
    withdraw.addElement(w[j]);
    j++;
    l=0;
    while(b[l].acc_no!=no)
    {
    l++;
    }
    bank.removeElement(b[l]);
    b[l].balance-=amt;
    bank.addElement(b[l]);
    break;
    case 3: System.out.println("Enter account number, amount and date:");
    no=Float.parseFloat(br.readLine());
    amt=Float.parseFloat(br.readLine());
    str1=br.readLine();
    d[k]=new Deposit();
    d[k].accept(str1,no,amt);
    deposit.addElement(d[k]);
    k++;
    l=0;
    while(b[l].acc_no!=no)
    {
    l++;
    }
    bank.removeElement(b[l]);
    b[l].balance+=amt;
    bank.addElement(b[l]);
    break;
    case 4: for(i=0;i<=bank.size()-1;i++)
    {
    System.out.println(bank.elementAt(i));
    }
    break;
    case 5: break;
    default: System.out.println("Invalid choice");
    }
    }
    }
    }

  6. #6
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: compile error in the line bufferedreader.. plz help me how do i compile and run this program

    You forgot to import BufferedReader

  7. #7
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    My Mood
    Cheerful
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: compile error in the line bufferedreader.. plz help me how do i compile and run this program

    thanku soooo much... it got compiled and its running now... tyty

Similar Threads

  1. [SOLVED] Java 1.4.2 and eclipse code will not compile or run need it to run for school!
    By ClarmonkGaming in forum What's Wrong With My Code?
    Replies: 12
    Last Post: January 23rd, 2014, 09:41 PM
  2. Replies: 8
    Last Post: February 12th, 2013, 05:45 AM
  3. Showrt program will compile but nothing happens when I run it.
    By learningjavanow in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 25th, 2012, 06:36 PM
  4. Please compile this program and see if it gives you an error
    By Programming_Hobbyist in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 2nd, 2012, 01:36 PM
  5. My program will compile but wont run
    By joshp1993 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 23rd, 2012, 07:45 AM