-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccounts.java
More file actions
71 lines (70 loc) · 3.5 KB
/
Copy pathAccounts.java
File metadata and controls
71 lines (70 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*****The Accounts class*****/
/* Here it's the default package */
package noureddinsameernaziralzar_2051710306;
/* Here I design and implement a class and name it "Accounts" */
public class Accounts {
/* Attributes of Accounts class......... */
/* Here I create (declare) a variable and name it "Account_Number" and its type is String */
private String Account_Number;
/* Here I create (declare) a variable and name it "BalanceOfAccount" and its type is double */
private double BalanceOfAccount;
/* Here I create (declare) a variable and name it "d" and its type is Holder */
private Holder d;
/* Constructors of Accounts class......... */
/* Here I create the constructor of Accounts class (no-parameter) */
public Accounts(){
/* Here I create an object from Holder class and "d" is the variable that is reference variable to the object */
d=new Holder();
/* Here I store the value of null in the variable Account_Number */
Account_Number=null;
/* Here I store the value of 0.0 in the variable BalanceOfAccount */
BalanceOfAccount=0.0;
}
/* Here I create the constructor of Accounts class (multiple parameters) */
public Accounts(String civil_ID,String NameOfHolder,int AgeOfHolder,char GenderOfHolder,double BalanceOfAccount){
/* Here I create an object from Holder class (multiple arguments) */
d=new Holder(civil_ID,NameOfHolder,AgeOfHolder,GenderOfHolder);
/* Here I set the account's balance */
this.BalanceOfAccount =BalanceOfAccount;
/* Here I set the account's number(Account_Number) */
Account_Number="BCD"+d.getCivil_IDOfHolder();
}
/* Methods(Actions) of the Accounts class......... */
@Override/* Here I override the toString method that is exist in the Object class */
public String toString(){
/* Here the method returns an assimilable String representation of the objects */
return Account_Number+" "+d.getNameOfHolder()+" "+d.getAgeOfHolder()+" "+d.getGenderOfHolder()+" "+BalanceOfAccount;
}
/* Getter methods(Accessor methods)......... */
/* Here I create a method to get the value of account's number(Account_Number) */
public String getAccount_Number() {
/* Here the method returns the value of account's number(Account_Number) */
return Account_Number;
}
/* Here I create a method to get the value of account's balance(BalanceOfAccount) */
public double getBalanceOfAccount() {
/* Here the method returns the value of account's balance(BalanceOfAccount) */
return BalanceOfAccount;
}
/* Here I create a method to get the object d */
public Holder getD() {
/* Here the method returns the object d */
return d;
}
/* Setter methods(Mutator methods)......... */
/* Here I create a method to set the account's number(Account_Number)(one parameter) */
public void setAccount_Number(String Account_Number) {
/* Here I set the account's number(Account_Number) */
this.Account_Number = Account_Number;
}
/* Here I create a method to set the account's balance(BalanceOfAccount)(one parameter) */
public void setBalanceOfAccount(double BalanceOfAccount) {
/* Here I set the account's balance(BalanceOfAccount) */
this.BalanceOfAccount = BalanceOfAccount;
}
/* Here I create a method to set the object d(one parameter) */
public void setD(Holder d) {
/* Here I set the value of object d */
this.d = d;
}
}