Answered step by step
Verified Expert Solution
Link Copied!

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 (80)
Overview:
4
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 high-tech promotion on Tuesdays, and a bring-a-friend promotion on Fridays. On Sundays, a rep will call customers who enjoy football attempting to sell them football-related products while discussing the customer's favorite team. On Tuesdays, a rep will call customers with a grade point average (GPA) of 3.75 or higher to sell them non-fiction 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
5
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. i.e.:
name: Sarah Johnson phone number: 2123231245
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. i.e.:
name: Javier Jones phone number: 8568768765
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. i.e.:
name: Javier Jones phone number: 8568768765
friends are Maria Regina,9086547654
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 Customer("John Smith" ,"9084321212", "football",
"Giants", 3.61, null ,0, null),
new Customer("Indira Patel" ,"7325551234", "tennis" ,
null ,3.92, "Java" ,0, null),
new Customer("Sarah Johnson", "2123231245", "football",
6
"Eagles", 3.71, null ,1,
"Jane Hernadez,2017765765"),
new Customer("Javier Jones" ,"8568768765", "golf" ,
null ,3.85, "Physics", 1,
"Maria Regina,9086547654")
};
main method
Create a BiFunction fSport for Customer, Integer and SportRecord types defined by a lambda expression with inputs (x,z) th

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

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

More Books

Students also viewed these Databases questions

Question

3. Why do banks not eliminate the need for money

Answered: 1 week ago

Question

How We Listen?

Answered: 1 week ago