JenkinsSonaImron
3 years ago
6 changed files with 120 additions and 8 deletions
-
36src/main/java/hs/fulda/de/ci/exam/project/BankTransaction.java
-
12src/main/java/hs/fulda/de/ci/exam/project/CashTransaction.java
-
20src/main/java/hs/fulda/de/ci/exam/project/CreditCardTransaction.java
-
15src/main/java/hs/fulda/de/ci/exam/project/FlightReservation.java
-
4src/main/java/hs/fulda/de/ci/exam/project/Payment.java
-
41src/test/java/hs/fulda/de/ci/exam/project/PaymentTest.java
@ -0,0 +1,36 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
public class BankTransaction extends Payment { |
|||
String bankName; |
|||
String iban; |
|||
|
|||
public BankTransaction(int id, String amount, PaymentStatus status, String bankName, String iban) { |
|||
super(id, amount, status); |
|||
this.bankName = bankName; |
|||
this.iban = iban; |
|||
} |
|||
|
|||
public String getBankName() { |
|||
return bankName; |
|||
} |
|||
|
|||
public void setBankName(String bankName) { |
|||
this.bankName = bankName; |
|||
} |
|||
|
|||
public String getIban() { |
|||
return iban; |
|||
} |
|||
|
|||
public void setIban(String iban) { |
|||
this.iban = iban; |
|||
} |
|||
|
|||
@Override |
|||
public boolean isValid() { |
|||
if (this.iban.length() != 22) { |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
public class CashTransaction extends Payment { |
|||
public CashTransaction(int id, String amount, PaymentStatus status) { |
|||
super(id, amount, status); |
|||
} |
|||
|
|||
@Override |
|||
public boolean isValid() { |
|||
return true; |
|||
} |
|||
} |
@ -1,10 +1,24 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
public class CreditCardTransaction extends Payment { |
|||
String nameOnCard; |
|||
String cardNumber; |
|||
|
|||
public CreditCardTransaction(int id, String amount, PaymentStatus status, String nameOnCard) { |
|||
public CreditCardTransaction(int id, String amount, PaymentStatus status, String cardNumber) { |
|||
super(id, amount, status); |
|||
this.nameOnCard = nameOnCard; |
|||
this.cardNumber = cardNumber; |
|||
} |
|||
|
|||
public String getCardNumber() { |
|||
return cardNumber; |
|||
} |
|||
|
|||
public void setCardNumber(String cardNumber) { |
|||
this.cardNumber = cardNumber; |
|||
} |
|||
|
|||
@Override |
|||
public boolean isValid() { |
|||
if (this.cardNumber.length() != 20) return false; |
|||
return true; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue