Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class Campaign{
- private String campName;
- private String campType;
- private double campGoal=10000.0;
- private double donationAmount;
- private double donationTotal;
- Campaign(String campName, String campType, double campGoal, double donationAmount, double donationTotal) {
- this.campName = campName;
- this.campType = campType;
- this.campGoal = campGoal;
- this.donationAmount = donationAmount;
- this.donationTotal = donationTotal;
- }
- public String getCampName(){
- return campName;
- }
- public String getCampType(){
- return campType;
- }
- public double getCampGoal(){
- return campGoal;
- }
- public double getDonationAmount(){
- return donationAmount;
- }
- public void setCampName (String campName) {
- this.campName = campName;
- }
- public boolean setCampType(String campType){
- if(campType.equalsIgnoreCase("Non Profit") || (campType.equalsIgnoreCase("For Profit"))){
- this.campType=campType;
- return true;
- }else{
- return false;
- }
- }
- public boolean setCampGoal(double campGoal){
- if(campGoal>0 && campGoal<25000){
- this.campGoal=campGoal;
- return true;
- }else{
- return false;
- }
- }
- /* this is to be removed if necessary(testing)
- public boolean setDonationAmount(double donationAmount, double campGoal, double donationTotal){
- if(donationAmount>0 && donationAmount<=campGoal){
- this.donationAmount=donationAmount;
- this.donationTotal+=donationAmount;
- return true;
- }else{
- return false;
- }
- }
- */
- public double getDonationTotal(){
- return donationTotal;
- }
- public void setDonationTotal(double donationAmount){
- if(donationAmount<=campGoal){
- this.donationTotal+=donationAmount;
- }
- }
- public double calculateFee(String campType, double donationTotal){
- if(campType.equalsIgnoreCase("For Profit")){
- return donationTotal+= (donationTotal - (donationTotal*0.05));
- }else if(campType.equalsIgnoreCase("Non Profit")){
- return donationTotal;
- }else{
- return donationTotal;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement