ava. Check ‘n Shop is a grocery supermarket in South Africa that provides a loyalty program to customers on a monthly basis.  Customers earn points based on the number of visits and the amount they spend, especially on healthy foods during the month. The private data fields for the Shopper object class are: See attached image   The constructor must assign values of the parameters to the private data field variables.  The static variable should be incremented by one in the constructor.  The increaseLoyaltyPoints() method calculates the number of loyalty points based on the amount a customer spent at the supermarket. All customers receive 100 free points e

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

java.

Check ‘n Shop is a grocery supermarket in South Africa that provides a loyalty program to customers on a monthly basis.  Customers earn points based on the number of visits and the amount they spend, especially on healthy foods during the month.

The private data fields for the Shopper object class are: See attached image

 

The constructor must assign values of the parameters to the private data field variables.  The static variable should be incremented by one in the constructor. 

The increaseLoyaltyPoints() method calculates the number of loyalty points based on the amount a customer spent at the supermarket. All customers receive 100 free points each month.  Use the following criteria to calculate the additional points earned to be added to the 100 free points:

  • For every four rands (R4) spent, one loyalty point is awarded. Make use of an appropriate Math class function to round up the loyalty points to a whole number.  

The updateHealthLevel() method receive the total amount spent on health food as a parameter.  Calculate the percentage that was spent on healthy food and set the data field for the health level according to the criteria provided in the table below:  

The customer earned more than 200 loyalty points and the shop was visited more than 5 times during the month, or the health level of the customer is platinum. The identifySmartShopper() method indicate whether the customer is a SMART shopper or not.  A customer is a SMART shopper if the following applies:

  • The string to be returned must either be “SMART Shopper” or an empty string. 

The toString() method must compile a string to display all the attributes of the object on one line. 

2. Create a testShopper class.  Do the following: 

Declare an array called arrShoppers of 10 Shopper type objects in the main method.

Write a static method in the test class called fillArray() to receive the array and number of objects created.

Use a while loop to enter the information (name of customer, number of visits, amount spent, amount spent on health foods). 

Expert Solution
steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY