Results 1 to 4 of 4

Thread: Help guys

  1. #1
    Taher is offline Member
    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0

    Post Help guys

    HI

    I am trying to create a bank teller application. could some one please me help to create a new current account and store the result in some sort of file thank you.

    Java Code:
    
    package com.fdm.bank;
    
    
    public final class BankAccountOutputVO
    {
    	private final String accountNumber;
    	private final String accountType;
    	private final String name;
    	private final String balance;
    	private final String overdraft;
    	private final boolean successfulTransaction;
    
    	public BankAccountOutputVO(String accountNumber, String accountType, String name, String overdraft, String balance, boolean successfulTransaction)
    	{
    		this.accountNumber = accountNumber;
    		this.accountType = accountType;
    		this.name = name;
    		this.overdraft = overdraft;
    		this.balance = balance;
    		this.successfulTransaction = successfulTransaction;
    	}
    
    	public boolean isSuccessfulTransaction()
    	{
    		return successfulTransaction;
    	}
    
    	public String getAccountNumber()
    	{
    		return accountNumber;
    	}
    
    	public String getBalance()
    	{
    		return balance;
    	}
    
    	public String getName()
    	{
    		return name;
    	}
    
    	public String getAccountType()
    	{
    		return accountType;
    	}
    
    	public String getOverdraft() 
    	{
    		return overdraft;
    	}
    	
    }
    Java Code:
    package com.fdm.bank;
    
    public class SavingAccount extends Account{
    	
    	public SavingAccount(String name, int accountNumber, double balance,
    			String accountType) {
    		super(name, accountNumber, balance, accountType);
    		// TODO Auto-generated constructor stub
    	}
    
    	protected  String interest;
    	protected int numberofyears;
    	protected int interestrate;
    	
    	
    	public String getInterest() 
    	{
    		return interest;
    	}
    
    
    	
    	public double getBalance() {
    		return (balance);
    	}
    	
    	public void withdrawal(double amount) {
    		if (amount <= balance)
    			balance -= amount;
    		else
    			System.out.println("Not enough money in account.");
    	}
    }
    Java Code:
    
    package com.fdm.bank;
    
    import java.util.List;
    
    /**
     * @author keith.dauris
     *
     */
    public interface _BankManager {
    
    	/**
    	 * Creates a new current account and then returns details to user
    	 * @param name
    	 * @param amount
    	 * @param overdraftLimit
    	 * @return The value object holding summary details for this account
    	 */
    	public BankAccountOutputVO createNewCurrentAccount(String name,
    			double amount, double overdraftLimit);
    
    	/**
    	 *
    	 * @param name
    	 * @param amount
    	 * @return The value object holding summary details for this account
    	 */
    	public BankAccountOutputVO createNewSavingsAccount(String name,
    			double amount);
    
    	/**
    	 *
    	 * @param accountNumber
    	 * @param amount
    	 * @return The value object holding summary details for this account
    	 */
    	public BankAccountOutputVO makeDeposit(String accountNumber, double amount);
    
    	/**
    	 *
    	 * @param accountNumber
    	 * @param amount
    	 * @return The value object holding summary details for this account
    	 */
    	public BankAccountOutputVO makeWithdrawal(String accountNumber,
    			double amount);
    
    	/**
    	 *
    	 * @return The list of all accounts currently held in the bank. This list
    	 * must consist of objects of type BankAccountOutputVO.
    	 */
    	public List<BankAccountOutputVO> listAllAccounts();
    
    	/**
    	 *
    	 * @param accountNumber
    	 * @return The value object holding summary details for this account
    	 */
    	public BankAccountOutputVO ViewAccountSummary(String accountNumber);
    
    	/**
    	 *
    	 * @param accountNumber
    	 * @return The value object holding summary details for this account
    	 */
    	public BankAccountOutputVO closeAcount(String accountNumber);
    }
    Java Code:
    package com.fdm.bank;
    
    import java.util.List;
    
    
    public class BankManager implements _BankManager
    {
    	public Account acc;
    	public BankAccountOutputVO ViewAccountSummary(String accountNumber)
    	{
    		
    		return null;
    		
    	}
    
    	
    	public BankAccountOutputVO closeAcount(String accountNumber)
    	{
    		return null;
    	}
    
    	public BankAccountOutputVO createNewCurrentAccount(String name,
    			double amount, double overdraftLimit)
    	{
    		System.out.println("Name: "+name+" amount: "+amount+" odlimit: "+overdraftLimit);
    		
    		setAcc(new Account(name, amount, overdraftLimit));
    	
    		return null;
    		
    	}
    
    	public BankAccountOutputVO createNewSavingsAccount(String name,
    			double amount)
    	{
    		setAcc(new SavingAccount(name, 0, amount, name));
    		return null;
    		
    	}
    
    	public List<BankAccountOutputVO> listAllAccounts()
    	{
    		// TODO Auto-generated method stub
    		return null;
    	}
    
    	public BankAccountOutputVO makeDeposit(String accountNumber, double amount)
    	{
    		// TODO Auto-generated method stub
    		return null;
    	}
    
    	public BankAccountOutputVO makeWithdrawal(String accountNumber,
    			double amount)
    	{
    		// TODO Auto-generated method stub
    		return null;
    	}
    
    
    	public void setAcc(Account acc) {
    		this.acc = acc;
    	}
    
    
    	public Account getAcc() {
    		return acc;
    	}
    }
    Java Code:
    package com.fdm.bank;
    
    public class Account {
    	public String name;
    	public int accountNumber;
    	public double balance;
    	public String accountType;
    	public boolean successfulTransaction;
    
    	public Account(String name, int accountNumber, double balance,
    			String accountType) {
    		this.name = name;
    		this.accountNumber = accountNumber;
    		this.balance = balance;
    		this.accountType = accountType;
    	}
    
    	public Account(String name, double amount, double overdraftLimit) {
    		// TODO Auto-generated constructor stub
    	}
    
    	public int getAccountNumber() {
    		return accountNumber;
    	}
    
    	public String getName() {
    		return name;
    	}
    
    	public String getAccountType() {
    		return accountType;
    	}
    
    	public void deposit(double amt) {
    		balance += amt;
    	}
    
    	public static void main(String args[ ]){
    		System.out.println("Name:"); 
    	}
    
    
    	public int getacc() {
    		return accountNumber;
    	}
    
    	
    
    
    }
    Java Code:
    package com.fdm.bank;
    
    public class CurrentAccount extends Account 
    {
    	public CurrentAccount(String name, int accountNumber, int balance,
    			String accountType) {
    		super(name, accountNumber, balance, accountType);
    		// TODO Auto-generated constructor stub
    	}
    
    
    	private int overdraft;
    	
    	
    	public int setOverdraft(int overdraft) 
    	{
    		overdraft=-500;
    		return overdraft;
    	}
    
    	public double getBalance() {
    		return (balance + overdraft);
    	}
    	
    	public void withdrawal(double amount) {
    		if (amount <= balance + overdraft)
    			balance -= amount;
    		else
    			System.out.println("You have reached your maxium overdraft limit.");
    	}
    }

  2. #2
    Taher is offline Member
    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0

    Default Poloymorphism

    I have been told to use poloyphorism but i am not sure what this is.

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

    Default

    We're not going to write your code for you.
    You have all the information there, and sample classes, to use to write the class yourself.

    Come back when you have a specific question on a piece of code you are working on.
    And I'm sure you can Google polymorphism. I expect there's a reasonable wiki page on it.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Hi guys,
    By dhana.munjeti@gmail.com in forum New To Java
    Replies: 2
    Last Post: 05-20-2010, 10:47 AM
  2. Hello Guys...
    By balaram.bocha in forum Introductions
    Replies: 0
    Last Post: 02-03-2009, 07:11 PM
  3. Hello Guys!
    By jeraldjamescapao in forum New To Java
    Replies: 3
    Last Post: 11-23-2008, 08:39 AM
  4. Hello Guys!
    By jeraldjamescapao in forum Advanced Java
    Replies: 1
    Last Post: 11-22-2008, 08:42 PM
  5. Help Me Out Guys
    By prince24 in forum New To Java
    Replies: 10
    Last Post: 07-13-2007, 05:52 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
  •