Question: Classes A CustomerPoints class maintains information about a customer. This information is the customer name ( entire name as a String ) and the amount

Classes
A CustomerPoints class maintains information about a customer. This information is the customer name (entire name as a String) and the amount of points (as an int) the customer has accrued.
Methods:
Constructor: Receives a name and sets the name field to the received name and sets the points field to 0(zero).
getName: Returns the customer's name
getPoints: Returns the customer's current points
toString: Returns a String representation of the current state in the form- name points, i.e. Bob 15
clearPoints: Sets the points field to 0(zero)
addPoints: Receives an integer and adds the received integer to the points field
reducePoints: Receives an integer and subtracts the received integer from the points field. If the result is 0, the points field should be reset to 0.
The following code segment interacts with a CustomerPoints object:
CustomerPoints cust = new CustomerPoints("Carl");
System.out.println(cust);
cust.addPoints(5);
cust.addPoints(12);
System.out.println(cust);
cust.reducePoints(2);
System.out.println(cust);
cust.clearPoints();
System.out.println(cust);
OUTPUT PRODUCED:
Carl 0
Carl 17
Carl 15
Carl 0
Complete the CustomerPoints class by filling in the blank boxes (DO NOT USE this. as it should not be used based on the software engineering documentation techniques learned during the course)
 Classes A CustomerPoints class maintains information about a customer. This information

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!