Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package online;
- public class Online
- {
- public static void main(String[] args)
- {
- Account a= new Account ();
- FixedDeposit f =new FixedDeposit();
- }
- }
- public class Account
- {
- private String name;
- private String id;
- private double balance;
- private String type;
- private int year;
- Account()
- {
- }
- Account(String name,String id,double balance,String type)
- {
- this.name=name;
- this.id=id;
- this.balance=balance;
- this.type=type;
- }
- public void setname(String name)
- {
- this.name=name;
- }
- public void setid(String id)
- {
- this.id=id;
- }
- public void sebalance(double balance)
- {
- this.balance=balance;
- }
- public void settype(String type)
- {
- this.type=type;
- }
- public String getname()
- {
- return name;
- }
- public String getid()
- {
- return id;
- }
- public double getbalance()
- {
- return balance;
- }
- public String gettype()
- {
- return type;
- }
- public void showinfo()
- {
- System.out.println(name);
- System.out.println(id);
- System.out.println(balance);
- System.out.println(type);
- }
- public boolean withdrawMoney(double money)
- {
- if(money<=balance)
- {
- this.balance=balance-money;
- return true;
- }
- else
- {
- return false;
- }
- }
- public boolean depositemoney(double money)
- {
- if(money>0)
- {
- this.balance=balance+money;
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- public class FixedDeposit extends Account
- {
- private double balanc;
- private int ContactYear;
- private int month;
- private double interestRate;
- FixedDeposit()
- {
- super();
- }
- FixedDeposit(int ContactYear,int month,double interestRate)
- {
- this.ContactYear=ContactYear;
- this.month=month;
- this.interestRate=interestRate;
- }
- public void setContactYear(int ContactYear)
- {
- this.ContactYear=ContactYear;
- }
- public void setmonth(int month)
- {
- this.month=month;
- }
- public void setinterestRate()
- {
- this.interestRate=interestRate;
- }
- public int getContactYear()
- {
- return ContactYear;
- }
- public int getmonth()
- {
- return month;
- }
- public double getinterestRate()
- {
- return interestRate;
- }
- public boolean isWithdraw()
- {
- if((month/12)>=ContactYear)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- public void incMonth()
- {
- month++;
- }
- public void ShowInterestMoney()
- {
- System.out.println(balanc*interestRate*month);
- }
- public void Withdraemoney(double money)
- {
- if((month/12)>=ContactYear)
- {
- this.balanc=balanc-money;
- System.out.println("withdrawn : "+money);
- System.out.println("balance is : "+this.balanc);
- }
- else
- {
- System.out.println("before time limit");
- System.out.println(this.balanc);
- }
- }
- }
Add Comment
Please, Sign In to add comment