Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Python: Now Wake-Mart wants an upgrade of the system. First, they want the

ID: 3576176 • Letter: U

Question

Using Python:

Now Wake-Mart wants an upgrade of the system. First, they want the customer to register before ordering items. They only accept payment by credit card or debit card now. The customer must enter card information during the registration process. Second, instead of asking the customer to enter the price of each item and the value of each coupon, now they want the customer to enter a 4-digit code for each item and each coupon, and the program will look up the price from a price list or the value of the coupon from a coupon list. The following lists the requirements of this project.

Define a Customer class. The following class diagram shows the design of this class:

Customer

-name: String

-credit_card_num: String

-credit_security_code: String

-debit_card_num: String

-debit_pin: String

+create(name: String)

+inputCardsInfo()

+verifyCreditCard(security_code: String): Bool

+verifyDebitCard(pin: String): Bool

+creditCardLastFour(): String

+debitCardLastFour(): String

This class has 5 private instance variables to store customer name, credit card number, credit card security code, debit card number, and debit card PIN. It has 6 methods. The constructor receives customer name as an argument and stores it in an instance variable. It should also create the other instance variables and initialize them all to empty strings.

In the inputCardInfo method, the user enters credit card number, credit card security code, debit card number and debit card PIN. All these input values should be stored in instance variables.

The goal of the verifyCreditCard method is to check whether the security code is correct. This method is called when the user chooses to pay by credit card. It compares the security code entered by the user during check out against the security code stored in the Customer object. If they are the same, this method returns True. Otherwise, it returns False.

The verifyDebitCard method is similar. It compares the PIN entered by the user during check out against the PIN stored in the Customer object. If they are the same, this method returns True. Otherwise, it returns False.

The creditCradLastFour method returns the last four digits of the credit card number, while the debitCardLastFour returns the last four digits of the debit card number.

Customer

-name: String

-credit_card_num: String

-credit_security_code: String

-debit_card_num: String

-debit_pin: String

+create(name: String)

+inputCardsInfo()

+verifyCreditCard(security_code: String): Bool

+verifyDebitCard(pin: String): Bool

+creditCardLastFour(): String

+debitCardLastFour(): String

Explanation / Answer

class Customer:
   def create(self,name):
       self.name = name
       self.credit_card_num = ''
       self.debit_card_num = ''
       self.credit_card_pin = ''
       self.debit_card_pin = ''
   def inputCardsInfo(self,credit_card_num,debit_card_num,credit_card_pin,debit_card_pin):
       self.credit_card_num = credit_card_num
       self.debit_card_num = debit_card_num
       self.credit_card_pin = credit_card_pin
       self.debit_card_pin = debit_card_pin
    def verifyCreditCard(self,security_code):
       if self.credit_card_pin == security_code:
           return true
       return false
   def verifyDebitCard(self , pin):
        if self.debit_card_pin == pin:
           return true
       return false
   def creditCardLastFour(self):
       return self.credit_card_num[-4:]
   def debitCardLastFour(self):
       return self.debit_card_num[-4:]

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote