Created
November 4, 2012 13:39
-
-
Save anonymous/4011954 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class bankAccount { | |
public static void main(String[] args){ | |
Scanner in = new Scanner(System.in); | |
System.out.println("BankAccount " + accountNumber); | |
System.out.println("Has a balance of " + balance); | |
bankAccount account = new bankAccount(); | |
account.deposit(500); | |
account.withdraw(50); | |
} | |
public static double intialBalance=1000; | |
private static double balance; | |
private static int accountNumber; | |
private static int lastAccountNumber=0; | |
public static double depositAmount; | |
public static double withdrawAmount; | |
public void bankAccount(double intialBalance) | |
{ | |
balance = intialBalance; | |
accountNumber = lastAccountNumber +1; | |
lastAccountNumber = accountNumber; | |
} | |
public static void deposit(double depositAmount) | |
{ | |
balance +=depositAmount; | |
} | |
public static boolean withdraw(double withdrawAmount) | |
{ | |
if (withdrawAmount > balance){ | |
System.out.println("Insufficient Funds!!!"); | |
return false; | |
} else { | |
balance-=withdrawAmount; | |
return true; | |
} | |
} | |
public double getbalance() | |
{ | |
return balance; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment