Question: package edu.buffalostate.cis 4 2 5 . sp 2 4 . put - your - username - here; / * * * File: Donor.java * *
package edu.buffalostate.cisspputyourusernamehere;
File: Donor.java
Description: This class represents a donor to an
organization. It stores the donor's name and rating.
The main method tests the class's methods.
Requirements:
Add a new level "low" to this class in addition to "high", "medium", "none"
Add a new method:
public void updateRatingdouble amt which recalculates
a donor's rating according to the following schedule:
a amt none
b amt $ low
c amt $ and amt $ medium
d amt $ high
updateRating should change the instance variable:
rating to the new value
Modify this template to include an address variable and
change the constructor to accept this new variable
along with the parameters Basically, the object
stores the donor's name, address and rating
Modify main to print out donor address also
Create a new donor donor with an initial "low" rating,
a then let donor contribute $
b print this donor's new rating to the console
Modify the rest of the program as needed so that it
compiles and runs correctly
@author putyournamehere
public class Donor
private String name no name";
private String rating "none";
Donor constructor sets the object's name and rating
@param str a String giving the donor's name
@param str a String giving the donor's rating
public DonorString str String str
name str;
rating str;
Hint: add address string here
getName returns the donor's name
@return a String giving the person's name
public String getName
return name;
Hint: add accessor method to get the address
getRating returns the donor's rating
@return a String giving the person's rating
public String getRating
This if could be a switchcase conditional
add check for low level
if ratingequalshigh
return "high";
else if ratingequalsmedium
return "medium";
else
return "none";
main creates three Donor instances and tests this classes methods.
public static void main String argv
Hint: add address string to the three constructors
Donor donor new Donorputdonornamehere", "high";
Hint: add address string to the output
System.out.printlnDonors name is donorgetName;
System.out.printlndonorgetNames rating is donorgetRating;
Donor donor new Donorputdonornamehere", "medium";
System.out.printlnDonors name is donorgetName;
System.out.printlndonorgetNames rating is donorgetRating;
Donor donor new Donorputdonornamehere", "none";
System.out.printlnDonors name is donorgetName;
System.out.printlndonorgetNames rating is donorgetRating;
add code to construct donor and print donor info
add code to increase donors amount updateRating
and print out new donor rating
end main
end Donor class
When you have this Exercise ready for me to view and grade, you should upload your Donor.java file here.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
