We want to realize a program for managing the fund-raising activities of volunteers working in a no-profit organization. For each volunteer, the following information is stored:
Write a class
Volunteer that implements the following methods:
Volunteer(String name): constructor that creates an object representing a volunteer whose name is
name, whose initial bonus is 0, and whose initial amount of money is 0.
String getName(): that returns the name of the volunteer;
double getBonus(): that returns the bonus of the volunteer.
double getAmount(): that returns the amount of money collected by the volunteer;
void collect(double m): that increases the amount of money collected by the volunteer by
mis greater than or equal to 1000, then the bonus is increased by 1 (percent).
void spend(double m): that decreases the amount of money collected by the volunteer by
mis smaller or equal than the amount of money collected, and otherwise does nothing.
void useBonus(): that increases the amount of money collected by the volunteer by the percentage specified by the bonus, and sets then the bonus to 0.
String toString(): that returns a string with all the information about the volunteer.
Write a class
UseVolunteer, client of
contains the following public static method:
static double totalAmount(Volunteer v1, Volunteer v2): that, given two volunteers
v2, calculates and returns the sum of the amount of money raised by the two volunteers, considering also the bonuses.
v2is applied to the sum of the money raised by