The XYZ School wants to take its grade 10 students on a trip…..solved




5/5 - (2 votes)

The XYZ School wants to take its grade 10 students on a trip.
The cost of the trip is $5,000.00.The school has only thirty days in which to collect the funds in order to go on the trip.
Design a class called SchoolContribution that creates a contribution account.
In your design incorporate the following:• A mutator method called totalContribution(..) that accepts and accumulates the daily contributions.•
A Boolean method called hasMoreTime() that determines if more time is available in which to reach the targeted amount.•
A Boolean method called needMoreMoney() that determines if more contribution is needed to meet the target.•
This must be based on meeting the target within the time frame.•
A method called getTotalContribution() that returns the total contribution.•
A method called toString() that returns the result.Write a test class called TestContribution that generates the daily contributions. It keeps asking for contributions until it determines that either the targeted amount of contribution is met, or the time allotted to collecting the amount of money expires. In either case it displays the amount of money collected each day, and the total amount accumulated over the period.