Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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, ie Bob
clearPoints: Sets the points field to 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 the points field should be reset to
The following code segment interacts with a CustomerPoints object:
CustomerPoints cust new CustomerPointsCarl;
System.out.printlncust;
cust.addPoints;
cust.addPoints;
System.out.printlncust;
cust.reducePoints;
System.out.printlncust;
cust.clearPoints;
System.out.printlncust;
OUTPUT PRODUCED:
Carl
Carl
Carl
Carl
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started