Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVASCRIPT , I need the code. Thank you. Part A:d Create a class Customer that allows: creating customer to signup for rewards program, with the

JAVASCRIPT , I need the code. Thank you. image text in transcribed
Part A:d Create a class Customer that allows: creating customer to signup for rewards program, with the following fields: first, last name, rewardID and points (0.5 Points) Declare the instance variables of the Customer class (1.5 Points) Write a constructor to define all instance variables EXCEPT FOR the rewardID attribute. The rewardID is unique for each customer and cannot be the same for two different customers. You will use a static counter variable, to assign rewardID. Each time you construct a Customer instance, you will increment counter. The rewardID of a customer will be assigned this value of this counter. All other instance variables will be assigned using the parameters of the constructor. Use the "this" operator to reference instance variables. (1 Point) Create setters for both first and last name (0.75 Point) Create a method updateRewards to update the point based on purchase, this method takes a purchase/bill amount and adds 1 point for each dollar spent to the rewardsID (0.75 Point) Create a method redeemRewards that allows the customers to use points to pay the bill (customer gets a dollar for each 100 points). This method takes the bill amount as parameter, once bill is payed update the customer's reward points remaining. (0.5 Point) Create getter for reward points (0.75 Point) Create a static method customerCount that returns how many customers signed up to the rewards program. (0.75 Point) Create a toString() method that returns the information of the object as a String Part B Create an Orders class that allows creating customers and managing their accounts. This class serves a client class for Customer (0.5 Points) Create two customers with your name and partner name, customer1 and customer2, customer2 should be assigned 20000 point. (1 Point) Ask the user to enter a bill amount for customer1 and invoke the method updateRewards to updated customer1 rewards points based on the enter bill_amount .(1 Point) Ask the user to enter a bill amout (

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

More Books

Students also viewed these Databases questions

Question

Who are Microsofts key stakeholders in this case? Why?

Answered: 1 week ago