rootUser

Online2

May 28th, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 3.42 KB | None | 0 0
  1. package online;
  2.  
  3. public class Online
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.         Account a= new Account ();
  8.        
  9.         FixedDeposit f =new FixedDeposit();
  10.     }
  11.    
  12. }
  13.  
  14.  
  15.  
  16. public class Account
  17. {
  18.     private String name;
  19.     private String id;
  20.     private double balance;
  21.     private String type;
  22.     private int year;
  23.    
  24.     Account()
  25.     {
  26.        
  27.     }
  28.     Account(String name,String id,double balance,String type)
  29.     {
  30.         this.name=name;
  31.         this.id=id;
  32.         this.balance=balance;
  33.         this.type=type;
  34.     }
  35.     public void setname(String name)
  36.     {
  37.         this.name=name;
  38.     }
  39.     public void setid(String id)
  40.     {
  41.         this.id=id;
  42.     }
  43.     public void sebalance(double balance)
  44.     {
  45.         this.balance=balance;
  46.     }
  47.     public void settype(String type)
  48.     {
  49.         this.type=type;
  50.     }
  51.     public String getname()
  52.     {
  53.      return name;  
  54.     }
  55.     public String getid()
  56.     {
  57.         return id;
  58.     }
  59.     public double getbalance()
  60.     {
  61.         return balance;
  62.     }
  63.     public String gettype()
  64.     {
  65.         return type;
  66.     }
  67.     public void showinfo()
  68.     {
  69.         System.out.println(name);
  70.         System.out.println(id);
  71.         System.out.println(balance);
  72.         System.out.println(type);
  73.     }
  74.     public boolean withdrawMoney(double money)
  75.     {
  76.         if(money<=balance)
  77.         {
  78.             this.balance=balance-money;
  79.             return true;
  80.         }
  81.         else
  82.         {
  83.             return false;
  84.         }
  85.     }
  86.     public boolean depositemoney(double money)
  87.     {
  88.         if(money>0)
  89.         {
  90.             this.balance=balance+money;
  91.             return true;
  92.         }
  93.         else
  94.         {
  95.             return false;      
  96.         }
  97.     }
  98. }
  99.  
  100.  
  101. public class FixedDeposit extends Account
  102. {
  103.     private double balanc;
  104.     private int ContactYear;
  105.     private int month;
  106.     private double interestRate;
  107.    
  108.     FixedDeposit()
  109.     {
  110.         super();
  111.     }
  112.     FixedDeposit(int ContactYear,int month,double interestRate)
  113.     {
  114.         this.ContactYear=ContactYear;
  115.         this.month=month;
  116.         this.interestRate=interestRate;
  117.     }
  118.     public void setContactYear(int ContactYear)
  119.     {
  120.         this.ContactYear=ContactYear;
  121.     }
  122.     public void setmonth(int month)
  123.     {
  124.         this.month=month;
  125.     }
  126.     public void setinterestRate()
  127.     {
  128.         this.interestRate=interestRate;
  129.     }
  130.     public int getContactYear()
  131.     {
  132.         return ContactYear;
  133.     }
  134.     public int getmonth()
  135.     {
  136.         return month;
  137.     }
  138.     public double getinterestRate()
  139.     {
  140.         return interestRate;
  141.     }
  142.     public boolean isWithdraw()
  143.     {
  144.         if((month/12)>=ContactYear)
  145.         {
  146.             return true;
  147.         }
  148.         else
  149.         {
  150.             return false;    
  151.         }
  152.     }
  153.     public void incMonth()
  154.     {
  155.         month++;
  156.     }
  157.     public void ShowInterestMoney()
  158.     {
  159.         System.out.println(balanc*interestRate*month);
  160.     }
  161.     public void Withdraemoney(double money)
  162.     {
  163.         if((month/12)>=ContactYear)
  164.         {
  165.             this.balanc=balanc-money;
  166.             System.out.println("withdrawn : "+money);
  167.             System.out.println("balance is : "+this.balanc);
  168.         }
  169.         else
  170.         {
  171.             System.out.println("before time limit");
  172.             System.out.println(this.balanc);
  173.         }
  174.     }
  175. }
Add Comment
Please, Sign In to add comment