Answered step by step
Verified Expert Solution
Link Copied!

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 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)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

2. Develop a persuasive topic and thesis

Answered: 1 week ago

Question

1. Define the goals of persuasive speaking

Answered: 1 week ago