Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Sales Promotions ( 8 0 ) Overview: 4 A retailer runs weekly sales promotions targeting certain customers. If a customer has been targeted for a
Sales Promotions
Overview:
A retailer runs weekly sales promotions targeting certain customers. If a customer has been targeted for a promotion, a representative from the sales department will call him or her and discuss something of personal interest during the conversion. The retailer runs a football promotion on Sundays, a hightech promotion on Tuesdays, and a bringafriend promotion on Fridays. On Sundays, a rep will call customers who enjoy football attempting to sell them footballrelated products while discussing the customer's favorite team. On Tuesdays, a rep will call customers with a grade point average GPA of or higher to sell them nonfiction books while discussing the customer's favorite subject. On Fridays, a rep will call customers who have one or more friends on record to sell them any product and will ask permission to call their friend as well.
This program includes the following six classes: Customer, Record, SportsRecord, GPARecord, FriendsRecord and SalesPromotionDriver. The first five classes are just used to create simple objects which are manipulated by the sixth class.
Customer class
Customer has the following private instance variables. For each there is a mutator and an accessor method.
private String name
private String phoneNum
private String sport
private String team
private double gpa
private String subject
private int numFriends
String friends
There is a single constructor that accepts a value for each instance variable use the order above You can add a default method if you so desire, but it is not necessary.
Record class
Record is an abstract class.
Record has the following private instance variables. For each there is a mutator and an accessor method.
private String name
private String phoneNum
private int index
There is a single constructor that accepts a value for each instance variable use the order above You can add a default Constructor if you so desire, but it is not necessary. There is a toString method that includes the name and phone number and is incorporated into the toString of the each of its three subclasses.
SportRecord class
SportRecord is a subclass of Record.
It contains one additional private instance variable for which there is a mutator and an accessor method.:
private String team
There is a single constructor that accepts a value for each instance variable of the super class and for this classes instance variable. Remember to use super You can add a default constructor if you so desire, but it is not necessary.
There is a toString method that includes the name and phone number use super.toString and the team as shown in the output. ie:
name: Sarah Johnson phone number:
favorite team is the Eagles
GPARecord class
GPARecord is a subclass of Record.
It contains one additional private instance variable for which there is a mutator and an accessor method.:
private String subject
There is a single constructor that accepts a value for each instance variable of the super class and for this classes instance variable. Remember to use super You can add a default constructor if you so desire, but it is not necessary.
There is a toString method that includes the name and phone number use super.toString and the subject as shown in the output. ie:
name: Javier Jones phone number:
favorite subject is the Physics
FriendsRecord class
FriendsRecord is a subclass of Record.
It contains one additional private instance variable for which there is a mutator and an accessor method.:
private String friends
There is a single constructor that accepts a value for each instance variable of the super class and for this classes instance variable. Remember to use super You can add a default constructor if you so desire, but it is not necessary.
There is a toString method that includes the name and phone number use super.toString and the friends as shown in the output. ie:
name: Javier Jones phone number:
friends are Maria Regina,
SalesPromotionDriver class
This class includes a static predefined array of type Customer, a private method called matchCustomers, and a main method.
For this problem use the following insert inside the class statement
final static Customer customers
new CustomerJohn Smith" "football",
"Giants", null null
new CustomerIndira Patel" "tennis"
null "Java" null
new CustomerSarah Johnson", "football",
"Eagles", null
"Jane Hernadez,
new CustomerJavier Jones" "golf"
null "Physics",
"Maria Regina,
;
main method
Create a BiFunction fSport for Customer, Integer and SportRecord types defined by a lambda expression with inputs xz th
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