Results 1 to 2 of 2
  1. #1
    LukasHopkins is offline Member
    Join Date
    Aug 2012
    Rep Power

    Default Missing methods to print the account balances

    Hello I am reposting this because I wanted to be more discriptive in the title heading. Thanks!

    Hello, I am struggling with this assingment. The balance in this code prints 0.0 Why does this happen How can I fix that problem? Then the next part asks me to add println methods to the main function to show that the problem is fixed for all entries made into Mr. Partridge's account. Can anyone assist me with this?? Thanks!!

    class User{
    private int accountID,routingNum;
    private float balance, lastDepositAmount, lastWithdrawalAmount;
    private String[] info = new String[9]; //info(0) = First name, info(1) = middle name,
    //info(2) = Last Name, info(3) = Street Address,
    //info(4) = State, info(5) = Zip Code, info(6) = Tel
    //info(7) = email address, info(8) = Description
    private String creationDate,terminationDate;
    private String lastDepositDate, lastWithdrawalDate;

    static void getBalance(User user){System.out.println(user.balance);}
    static void getCreationDate(User user){System.out.println(user.creationDate);}
    static void setCreationDate(User user, String date){user.creationDate = date;}
    static void setTerminationDate(User user, String date){user.terminationDate = date;}
    static void getTerminationDate(User user){System.out.println(user.terminationDate);}
    static void setInfo(User user, String... input){
    for(int i=0;i<input.length;i++){[i] = input[i];}
    //for(int i=0;i<input.length;i++){System.out.println(input[i]);}
    static void getInfo(User user){
    for(int i=0;i<;i++){
    static void setDeposit(User user, float deposit,String date){user.balance+= deposit;user.lastDepositAmount = deposit;user.lastDepositDate = date;}
    static void setWithdrawal(User user,float withdrawal,String date){
    if(withdrawal > user.balance){
    System.out.println("Withdrawal amount exceeds balance.");
    user.balance-= withdrawal; user.lastWithdrawalAmount = withdrawal;
    user.lastWithdrawalDate = date;
    static void setAccountID(User user, int accountNum){user.accountID = accountNum;}
    static void getAccountID(User user){System.out.println(user.accountID);}
    static void setRoutingNum(User user, int routing){user.routingNum = routing;}
    static void getRoutingNum(User user){System.out.println(user.routingNum);}
    static void getLastDeposit(User user){System.out.println("Date of Deposit: "+user.lastDepositDate + " Amount "+ user.lastDepositAmount);}
    static void getLastWithdrawal(User user){System.out.println("Date of Withdrawal "+user.lastWithdrawalDate+" Amount "+user.lastWithdrawalAmount);}

    class c3p4{
    public static void main(String[] args){
    User user1 = new User();
    static void createAccount(){
    User user1 = new User();
    User.setAccountID(user1, 1234567);
    User.setRoutingNum(user1, 9872345);
    User.setInfo(user1,"John","C","Partridge","123 Liberty Way","VA","24502","555-3456","","This is a new account holder.");
    User.setDeposit(user1, 500.00f,"01/01/2010");
    User.setCreationDate(user1, "01/01/2010");

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: Missing methods to print the account balances

    Reposting the question and ignore the responses in the previous question is no way to motivate others to help you. Consider improving your previous question. Locking.

    Edit: and the hints towards the solution were given in one of the answers too! Again, please read all the links that Darryl provided as they will help you in asking questions here and again, please reply to the answers already given in your previous post. If you don't understand any of the points in either reply, please ask for clarification, but please out of fairness to the volunteers here, don't just ignore the replies.
    Last edited by Fubarable; 09-10-2012 at 05:30 AM.

Similar Threads

  1. Javax Print Attribute for Selection Print Range
    By rsawatzky in forum AWT / Swing
    Replies: 0
    Last Post: 04-26-2012, 12:14 AM
  2. Learning OOP and methods but missing something
    By gnng in forum New To Java
    Replies: 4
    Last Post: 04-17-2011, 05:23 PM
  3. Transfer from one account to another
    By vividcooper in forum New To Java
    Replies: 3
    Last Post: 01-26-2010, 10:43 PM
  4. validating account
    By ServletEst in forum Java Servlet
    Replies: 3
    Last Post: 08-24-2009, 01:11 PM
  5. Print the text file and print preview them
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:04 PM

Posting Permissions

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