Results 1 to 13 of 13
  1. #1
    jrdn128 is offline Member
    Join Date
    Nov 2014
    Posts
    10
    Rep Power
    0

    Default Help me to my Project in JAVA OOP training project.

    My instructor told me about the overview of our upcoming java oop project.

    the project is about something like banking system with debit/credit things. i dont know yet if we will use sql database.
    he hint us that the project is not big. and can finish half day or whole day(9hours).

    so please give me some advice(pointers) and tips & tricks what should i review. ! (our training is for entry level java oop programmer. we start from basic and to advance)! so basically our instructor will give us the requirements and we will build the program from the scratch. i will post the requirements tomorrow. (no spoon feeding please :>) i need to learn.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: Help me to my Project in JAVA OOP training project.

    i need to learn
    Well then why are you here rounding up troops? Its a bit of a rude approach you're taking here to be brutally honest - you don't even have anything that you need help with yet, but you're still here as if it is some kind of blessing that we will be allowed to support you through your project. That's not how it works, you do your damned best to not need any outside help at all first.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    jrdn128 is offline Member
    Join Date
    Nov 2014
    Posts
    10
    Rep Power
    0

    Default Re: Help me to my Project in JAVA OOP training project.

    i just need to prepfare myself, because i dont have good idea yet. how banking system works.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Help me to my Project in JAVA OOP training project.

    If it's only a small system (done in as little as half a day) then I doubt you'll be dealing with any complex banking logic beyond depositing money, withdrawing money and seeing your balance.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Help me to my Project in JAVA OOP training project.

    I moved this thread; there's nothing advanced about it.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    jrdn128 is offline Member
    Join Date
    Nov 2014
    Posts
    10
    Rep Power
    0

    Default Re: Help me to my Project in JAVA OOP training project.

    Quote Originally Posted by Tolls View Post
    If it's only a small system (done in as little as half a day) then I doubt you'll be dealing with any complex banking logic beyond depositing money, withdrawing money and seeing your balance.
    oic, so its not really an advance system.

  7. #7
    jrdn128 is offline Member
    Join Date
    Nov 2014
    Posts
    10
    Rep Power
    0

    Default Re: Help me to my Project in JAVA OOP training project.

    Quote Originally Posted by JosAH View Post
    I moved this thread; there's nothing advanced about it.

    kind regards,

    Jos
    okay man! thanks

  8. #8
    jrdn128 is offline Member
    Join Date
    Nov 2014
    Posts
    10
    Rep Power
    0

    Default Re: Help me to my Project in JAVA OOP training project.

    i am doing it right? heres my first code. please see the pdf attached file. that is the instruction given to us and theres an expected output also

    package sef.remedial.activity.impl;
    public class SavingsAccount extends Account{
    private Account account;
    double interestRate=0.5;

    public double calculateInterest(){
    interestRate=interestRate*account.balance;
    return calculateInterest();
    }
    public void printDetails(){
    System.out.println("Savings Initial Balance: "+balance);
    System.out.println("Savings Interest Rate: "+ interestRate);
    System.out.println("Current Interest: "+calculateInterest());
    }
    Attached Files Attached Files

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Help me to my Project in JAVA OOP training project.

    When posting code please wrap it in [code] tags [/code] to retain its formatting.

    Does it work?
    Does it fulfill the criteria?

    It looks (without going through the requirements) OK. I will say that the interestRate probably should be private. You should try and avoid exposing the internal attributes of a class.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,095
    Rep Power
    4

    Default Re: Help me to my Project in JAVA OOP training project.

    And you don't need the Account member since you already inherit from Account.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Help me to my Project in JAVA OOP training project.

    Oh yes.
    How did I miss that?
    (I blame the lack of code tags).
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  12. #12
    jrdn128 is offline Member
    Join Date
    Nov 2014
    Posts
    10
    Rep Power
    0

    Default Re: Help me to my Project in JAVA OOP training project.

    Quote Originally Posted by SurfMan View Post
    And you don't need the Account member since you already inherit from Account.
    thanks man! good eye!

  13. #13
    jrdn128 is offline Member
    Join Date
    Nov 2014
    Posts
    10
    Rep Power
    0

    Default Re: Help me to my Project in JAVA OOP training project.

    is there a way to use the calculateInterest to other class repeatedly? so i dont need to re-write the computation again.

    Java Code:
    package sef.remedial.activity.impl;
    
    public class SavingsAccount extends Account {
    
    	double interestRate = 0.05;
    	public double initialValue = 0;
    	public double initialBalance = 0;
    
    	public SavingsAccount(double amount) {
    		setAccountBalance(amount);
    		accountBalance = getAccountBalance();
    		printDetails();
    
    	}
    
    	public double calculateInterest() {
    		CurrentInterest = interestRate * accountBalance;
    		return CUrrentInterest();
    	}
    
    	public void printDetails() {
    		System.out.println("* SAVINGS ACCOUNT *\n");
    		System.out.println("Savings Initial Balance: " + accountBalance);
    		System.out.println("Savings Interest Rate: " + interestRate);
    
    	}
    
    }
    i want to re-use the calculateInterest here. but i dont know how.(really newbie)

    Java Code:
    package sef.remedial.activity.impl;
    
    import sef.remedial.activity.interfac.IAccount;
    
    public class Account implements IAccount {
    	public static  double accountBalance;
    	public static double CurrentInterest;
    	double interestRate=0.05;
    
    	
    	@Override
    	//DEPOSIT
    	public void credit(double amount) {
    		// TODO Auto-generated method stub
    		accountBalance = amount + accountBalance;
    		CurrentInterest = accountBalance*interestRate;
    		System.out.println("\nDeoposit: "+amount+" to savings account...");
    		System.out.println("Balance: "+accountBalance);
    		System.out.println("Current Interest: "+CurrentInterest);
    		System.out.println("Adding interest to savings... ");
    		System.out.println("New balance: "+(accountBalance + CurrentInterest));
    		
    	
    
    	}
    
    	public static double getAccountBalance() {
    		return accountBalance;
    	}
    
    	public void setAccountBalance(double accountBalance) {
    		this.accountBalance = accountBalance;
    		if (accountBalance > 0.0) {
    		this.accountBalance = accountBalance;
    		} else {
    		this.accountBalance = 0.0;
    		System.out.println("Error: Balance is invalid.");
    		}
    		}
    
    
    
    	@Override
    	//WITHDRAW
    	public boolean debit(double amount) {
    		// TODO Auto-generated method stub
    		getAccountBalance();
    		
    		System.out.println("\nWithdraw " +amount+" from savings account....");
    		
    		if (amount < accountBalance) {
    			accountBalance = accountBalance - amount;
    			CurrentInterest = accountBalance*interestRate;
    			System.out.println("Balance: "+accountBalance);
    			System.out.println("Current Interest: "+CurrentInterest);
    			return true;
    		} else {
    			System.out.println("Error: Debit amount exceeded account balance.");
    			return false;
    		}
    	}
    
    
    
    	@Override
    	public void printDetails() {
    		// TODO Auto-generated method stub
    		System.out.println("Account Balance is: "+accountBalance);
    
    	}
    
    }
    Last edited by JosAH; 12-15-2014 at 10:56 AM. Reason: changed [quote] tags to [code] tags ...

Similar Threads

  1. Replies: 2
    Last Post: 06-26-2014, 08:43 PM
  2. Replies: 6
    Last Post: 06-20-2014, 05:01 PM
  3. Replies: 7
    Last Post: 11-27-2012, 11:16 AM

Posting Permissions

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