Results 1 to 5 of 5
  1. #1
    haritha is offline Member
    Join Date
    Jan 2016
    Posts
    3
    Rep Power
    0

    Red face Java program using Bank Class

    Create object of Bank class and test above methods from main method in BankDemo class

    1. Declare Bank class with below attributes:
    a. Balance float
    Write below methods in this class.
    depositMoney(depostAmount) // adds amount to balance
    withdrawMoney(withdrawAmount) // subtracts amount from balance
    calculateInterest(interestPercentage) // calculates interest and adds to balance
    displayDetails() //displays the balance details

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Java program using Bank Class

    Do you have a question? And just so you know, we won't provide you code. Just help you debug your program.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    haritha is offline Member
    Join Date
    Jan 2016
    Posts
    3
    Rep Power
    0

    Arrow Error when this program is run.pls help

    public class ItemDemo {

    public static void main(String []args)
    {double n;
    Item ob[]=new Item[5];
    ob[0]=new Item(1,"BOX",100,10);
    ob[1]=new Item(2,"CRAYON",200,20);
    ob[2]=new Item(3,"SCALE",10,2);
    ob[3]=new Item(4,"BAG",600,100);
    ob[4]=new Item(5,"SUITCASE",1500,200);
    ob[5]=new Item(6,"POUCH",200,60);
    n=getLeastPriceItem(ob);
    System.out.println("Least price is" +ob[(int) n].getItemName());
    }

    public static double getLeastPriceItem(Item ob[])
    {double p[]=new double[5];
    double d[]=new double[5];
    int i;
    for(i=0;i<5;i++){
    p[i] = ob[i].getItemPrice();
    d[i] = p[i] - (ob[i].getItemDiscount() * 0.01 * p[i]);}
    double smallest = d[0];
    {if (d[i] < smallest)
    smallest = d[i];
    return smallest;}}}

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: Java program using Bank Class

    That code is not a solution to any part of the problem in your first post.

    Also, when posting code you should wrap it in [code] tags [/code].
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,991
    Rep Power
    8

    Default Re: Java program using Bank Class

    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Replies: 0
    Last Post: 05-08-2012, 01:03 PM
  2. Need help with my bank class
    By rpark712 in forum New To Java
    Replies: 2
    Last Post: 11-21-2011, 03:39 PM
  3. Create a java class for a bank account!!?
    By singh345 in forum New To Java
    Replies: 1
    Last Post: 03-17-2010, 04:26 PM
  4. java program for updating bank details
    By java__beginner in forum New To Java
    Replies: 5
    Last Post: 03-12-2009, 03:42 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •