/** * Second attempt at a class for storing and distributing * key information about a charity. Adds a constructor. * * @author ggtowell * Created: Nov 2023 */ public class Charity4 { private String name; private int donationTarget; private int donationsReceived; public Charity4(String nm, int dt, int dr) { this.name = nm; this.donationTarget = dt; this.donationsReceived = dr; } public String getName() { return name; } public int getDonationTarget() { return donationTarget; } public int getDonationsReceived() { return donationsReceived; } public void adjustDonationsReceived(int dr) { donationsReceived += dr; } public double percentageOfGoal() { return (double) (donationsReceived * 100) / donationTarget; } }