Question: Create a Customer class with fields for a customer's name, email address, and the number of times they've purchased something. Create a method to get
Create a Customer class with fields for a customer's name, email address, and the number of times they've purchased something. Create a method to get each of those values but do not create "set" methods Add a default constructor that automatically sets the values to Homer Simpson with the email homer@simpson.com and zero purchases. Overload the constructor with a version that accepts values for all three fields and assigns them appropriately. Finally, create a method called increasePurchases that adds to the number of purchases the customer has made. Save this work as Customer.java.
In a file called TestCustomer.java, instantiate two customer objects: one using the default constructor, and one by providing the values as parameters. Note that you do not need to prompt the user for this information, but you have that option. Call the increasePurchases method on at least one of the objects and then use the "get" methods to output values from both objects.
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
