Commit 7db38c07 authored by Suleman Hussain's avatar Suleman Hussain

finished

parent 4bb8bb0e
No preview for this file type
public class BankAccount {
public int accountNumber;
public String name;
public double balance;
public double overdraft;
BankAccount(int x,String y,double z) {
accountNumber= x;
name=y;
balance=z;
overdraft=0;
}
public void desposit(int i) {
balance = i + balance;
}
public double display() {
return balance;
}
public void setbal(int i) {
balance=i;
}
public void withdrawl(int i) {
double temp =this.balance-i;
if (this.overdraft<0)
{
if (temp>this.overdraft)
{
this.balance = this.balance - i;
}
}
else
{
this.balance=this.balance-i;
}
}
public void bankFees() {
double temp= 0.05 * this.balance;
this.balance=this.balance-temp;
}
public void addOverdraft(int x) {
x=0-x;
this.overdraft=x;
}
public double thisover() {
return overdraft;
}
}
public class Standard_Account { public class SavingAccount {
public int accountNumber; public int accountNumber;
public String name; public String name;
public double balance; public double balance;
SavingAccount() {}
SavingAccount(int x,String y,double z) {
accountNumber= x;
name=y;
balance=z;
}
public void desposit(int i) { public void desposit(int i) {
balance = i + balance; balance = i + balance;
...@@ -18,4 +26,10 @@ public class Standard_Account { ...@@ -18,4 +26,10 @@ public class Standard_Account {
public void withdrawl(int i) { public void withdrawl(int i) {
balance = balance - i; balance = balance - i;
} }
public void accrueInterest() {
double temp= 0.05 * this.balance;
this.balance=this.balance+temp;
}
} }
No preview for this file type
public class main { public class main {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
BankAccount bank = new BankAccount(); BankAccount bank = new BankAccount(111,"bob",10);
bank.setbal(5); bank.addOverdraft(15);
System.out.println(bank.thisover());
System.out.println(bank.display()); System.out.println(bank.display());
bank.withdrawl(9);
System.out.println(bank.display());
bank.withdrawl(100);
System.out.println(bank.display());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment