Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Customer class is an abstract superclass and it holds features that are common to all of its subclasses. Customer -firstName: String -lastName: String -custID:

The Customer class is an abstract superclass and it holds features that are common to all of its subclasses.  

Customer -firstName: String -lastName: String -custID: String Customer( firstName: String, lastName: String, custID: String): +getFirstName(): String +getLastName (): String +getCustID(): String +setFirstName(name: String): void +setLastName(name: String): void +setCustID(custID: String): void +getCustomerDetails(): String +getIncentives(): String BusinessCustomer -companyName: String -discountRate: double -totalPurchases: double Business Customer( firstName: String, lastName,: String, custID: String, companyName: String, discountRate: double, totalPurchases: double) +getDiscountRate(): double +setDiscountRate(discountRate: double): void +getTotalPurchases(): double +setTotalPurchases(purchases: double): void +getCompanyName(): String +setCompanyName(name: String): void +getCustomerDetails(): String +getIncentives(): String RetailCustomer -totalPurchases:double RetailCustomer( firstName: String, lastName: String, custID: String, totalPurchases: double) +getTotalPurchases(): double +setTotalPurchases(purchases: double): void +determine IncentiveRate(): double +getCustomerDetails(): String +getIncentives(): String The Customer class is an abstract superclass and it holds features that are common to all of its subclasses. All customers have a first and last name and a customerID. Note that there is a 3-arg constructor. Each of the private variables has a corresponding getter and setter method. There is also a method called getCustomer Details, which will return a string that lists the CustomerID, first name and last name of a customer. It does this by making calls to each of the getter methods and concatenating the String values that are returned by each getter into one long String. The getIncentives() method is an abstract method which will be implemented by each sub class of Customer There are different types of incentives for each kind of customer, so we'll over-ride this method in each sub class. The BusinessCustomer class is a sub class of Customer and represents a customer who has a representative with a name as well as a company name. There is a discount rate applied to each business customer, depending on who they are. This discount rate applied when a new customer is created. It can be overwritten anytime, utilizing the setDiscountRate mutator method. It has a 6-arg constructor. It also has a getter method for the discount rate. Also it has setter and getter methods for company Name and totalPurchases. Over-ride the getCustomerDetails() for this class so that it will return all of the details of the super class method along with a concatenated string that states that "Business Customer: with the company name: company Name. The getIncentives() method implementation for this class will simply return a string indicating what discount or incentive the customer is entitled to. The RetailCustomer class is also a sub class of Customer and represents a customer who frequents this company regularly. They have a first name, last name, and customer id. They also have made total purchases over the year. This has a 4 arg constructor. The getCustomerDetails method will return all the details of the super class method along with the concatenated string that states: "Retail Customer:" The getIncentives method for this class will return a string indicating the total incentive the customer is entitled too. The determineIncentiveRate Method will determine the actual discount rate. If total purchases are greater than $1000.00, they will get 5%, greater than $5000.00, they will get 10%. Greater than 10000, they will get 15%. (continued on next page)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

import javautilScanner public class TestCustomer public static void mainString args Create an array of type Customer named customerArray and size it t... 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 Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Programming questions

Question

How do you specify the active database in SQL Server 2014?

Answered: 1 week ago

Question

What is the purpose of this book?

Answered: 1 week ago

Question

Describe four uses of a primary key.

Answered: 1 week ago