-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made the Donation class with accessor-methods and javadoc
- Loading branch information
MatheaGjerde
committed
Mar 1, 2026
1 parent
0857d03
commit 082c2a3
Showing
6 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package edu.group5.app.model; | ||
|
|
||
| public class DBRepository { | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package edu.group5.app.model; | ||
|
|
||
| public class Repository { | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,77 @@ | ||
| package edu.group5.app.model.donation; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import java.sql.Timestamp; | ||
|
|
||
| /** | ||
| * Represents a verified donation made by a user to an organization. | ||
| */ | ||
| public class Donation { | ||
|
|
||
| private final int donationId; | ||
| private final int userId; | ||
| private final int organizationId; | ||
| private final BigDecimal amount; | ||
| private final Timestamp date; | ||
| private final String paymentMethod; | ||
|
|
||
| /** | ||
| * Constructs a new Donation. | ||
| * | ||
| * @param donationId - the unique ID of this donation | ||
| * @param userId - the ID of the user making the donation | ||
| * @param organizationId - the ID of the organization receiving the donation | ||
| * @param amount - the donation amount | ||
| * @param date - the timestamp when the donation was made | ||
| * @param paymentMethod - the payment method used | ||
| */ | ||
| public Donation(int donationId, int userId, int organizationId, BigDecimal amount, Timestamp date, String paymentMethod) { | ||
| this.donationId = donationId; | ||
| this.userId = userId; | ||
| this.organizationId = organizationId; | ||
| this.amount = amount; | ||
| this.date = date; | ||
| this.paymentMethod = paymentMethod; | ||
| } | ||
|
|
||
| /** | ||
| * @return the donation ID | ||
| */ | ||
| public int getDonationId(){ | ||
| return donationId; | ||
| } | ||
|
|
||
| /** | ||
| * @return the user ID of the donator | ||
| */ | ||
| public int getUserId(){ | ||
| return userId; | ||
| } | ||
|
|
||
| /** | ||
| * @return the organization ID that receives the donation | ||
| */ | ||
| public int getOrganizationId() { | ||
| return organizationId; | ||
| } | ||
|
|
||
| /** | ||
| * @return the donated amount | ||
| */ | ||
| public BigDecimal getAmount() { | ||
| return amount; | ||
| } | ||
|
|
||
| /** | ||
| * @return the timestamp of the donation | ||
| */ | ||
| public Timestamp getDate() { | ||
| return date; | ||
| } | ||
|
|
||
| /** | ||
| * @return the payment method used | ||
| */ | ||
| public String getPaymentMethod() { | ||
| return paymentMethod; | ||
| } | ||
| } |
4 changes: 4 additions & 0 deletions
4
src/main/java/edu/group5/app/model/donation/DonationRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package edu.group5.app.model.donation; | ||
|
|
||
| public class DonationRepository { | ||
| } |
4 changes: 4 additions & 0 deletions
4
src/test/java/edu/group5/app/model/donation/DonationRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package edu.group5.app.model.donation; | ||
|
|
||
| public class DonationRepositoryTest { | ||
| } |
4 changes: 4 additions & 0 deletions
4
src/test/java/edu/group5/app/model/donation/DonationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package edu.group5.app.model.donation; | ||
|
|
||
| public class DonationTest { | ||
| } |