Consider adding a doc comment for payOffDebt
104 }
105
106
107 public static boolean payOffDebt(String id, double amount) {108 double deposit, debt;109 String temp = SqlQuery.StringGetSQL("SELECT debt FROM clients WHERE id=" + id, "debt");110 debt = stringToDouble(temp);111 temp = SqlQuery.StringGetSQL("SELECT deposit FROM clients WHERE id=" + id, "deposit");112 deposit = stringToDouble(temp);113 if (amount > deposit) {114 System.out.println("Odemek istediginiz tutar bakiyenizden fazla olamaz. ");115 return false;116 } else if (amount > debt) {117118 deposit = deposit - debt;119 debt = 0;120 temp = String.valueOf(deposit);121 SqlQuery.UpdateData("UPDATE clients SET deposit=" + temp + "WHERE id=" + id);122 SqlQuery.UpdateData("UPDATE clients SET debt=0 WHERE id=" + id);123 System.out.println("girdiginiz tutar borcunuzdan fazladir, borcunuz: " + debt + " TL ödenmistir. ");124 return true;125126 } else {127 deposit = deposit - amount;128 //todo: handle if temp is not a string129 temp = String.valueOf(deposit);130 SqlQuery.UpdateData("UPDATE clients SET deposit=" + temp + "WHERE id=" + id);131 debt = debt - amount;132 temp = String.valueOf(debt);133 SqlQuery.UpdateData("UPDATE clients SET debt=" + temp + "WHERE id=" + id);134 return true;135 }136 }137
138
139}
Consider adding a doc comment for transfer
73
74
75
76 public static boolean transfer(String id, String IBAN, double amount) { 77 //todo: iban uzunlugunun kontrol edilmesi gerekli 78 if(IBAN.length()!=24) return false; 79 80 double depositSender, depositReceiver; 81 String temp = SqlQuery.StringGetSQL("SELECT deposit FROM clients WHERE id=" + id, "deposit"); 82 depositSender = stringToDouble(temp); 83 depositSender = depositSender - amount; 84 if (amount < 1) { 85 System.out.println("Gondereceginiz tutar 0'dan buyuk olmalıdır. "); 86 return false; 87 } 88 if (depositSender < amount) { 89 System.out.println("Bakiye yetersiz. "); 90 return false; 91 } 92 temp = SqlQuery.StringGetSQL("SELECT deposit FROM clients WHERE IBAN LIKE '%" + IBAN + "'", "deposit"); 93 depositReceiver = stringToDouble(temp); 94 95 depositReceiver = depositReceiver + amount; 96 97 temp = String.valueOf(depositReceiver); 98 SqlQuery.UpdateData("UPDATE clients SET deposit=" + temp + " WHERE IBAN LIKE '%" + IBAN + "'"); 99100 temp = String.valueOf(depositSender);101 SqlQuery.UpdateData("UPDATE clients SET deposit=" + temp + "WHERE id=" + id);102 return true;103104 }105
106
107 public static boolean payOffDebt(String id, double amount) {
Consider adding a doc comment for deposit
52 }
53
54
55 public static boolean deposit(String id, double amount) { 56 double deposit; 57 58 String temp = SqlQuery.StringGetSQL("SELECT deposit FROM clients WHERE id=" + id, "deposit"); 59 if (amount < 1) { 60 System.out.println("yatiralacak tutar sifirdan kucuk olamaz"); 61 return false; 62 } 63 64 deposit = stringToDouble(temp); 65 66 deposit = deposit + amount; 67 temp = String.valueOf(deposit); 68 SqlQuery.UpdateData("UPDATE clients SET deposit=" + temp + "WHERE id=" + id); 69 70 return true; 71 72 } 73
74
75
Consider adding a doc comment for withdraw
19
20
21
22 public static boolean withdraw(String id, double amount) { 23 double deposit; 24 if (amount < 10 || amount > 1000) { 25 System.out.println("cekilecek tutar 10'dan kucuk olamaz"); 26 return false; 27 } 28 29 String temp = SqlQuery.StringGetSQL("SELECT deposit FROM clients WHERE id=" + id, "deposit"); 30 31 32 try { 33 deposit = Double.parseDouble(temp); 34 System.out.println(deposit); 35 } catch (Exception e) { 36 e.printStackTrace(); 37 return false; 38 } 39 40 if (deposit < amount) { 41 System.out.println("cekilmek istenen tutar bakiyeden fazla.. "); 42 return false; 43 } else if (deposit > amount) { 44 deposit = deposit - amount; 45 temp = String.valueOf(deposit); 46 47 SqlQuery.UpdateData("UPDATE clients SET deposit=" + temp + "WHERE id=" + id); 48 49 return true; 50 } 51 return false; 52 } 53
54
55 public static boolean deposit(String id, double amount) {
Description
This method does not have any documentation.
Consider adding a documentation comment to explain its use.
While it may seem like the usage of a method is perfectly obvious, any consumers of your API may not be able to pick up on certain details.
Bad Practice
This method appears to return an address string based on its name and the return type, but it is hard to say anything further about it. We neither know if the address will be formatted in a special way nor are we given any useful information regarding the returned value.
String getAddress() {
// ...
}
Recommended
Provide a detailed description of what the method does.
/**
* Returns the address in 3 line format,
* with street address on line 1, area/city on line 2
* and state and country as well as postal code on line 3.
*/
String getAddress() {
// ...
}