Question No. 1 For an e-Shop, there is a Customer whose data is stored in a file ‘Customers.txt’, where ID, Name, Phone, Address, Email, and AmountBalance. When the customer buys a product and pays...



Question No. 1


For an e-Shop, there is a Customer whose data is stored in a file ‘Customers.txt’, where ID, Name, Phone, Address, Email, and AmountBalance. When the customer buys a product and pays from his AmountBalance, the system checks his balance and deducts if enough amount is there. Otherwise, the customer receives a message “You don’t have sufficient Balance in your wallet”.



  1. Write python code to create a ‘Customers.txt’ file with at least one customer’s record.

  2. Write a function
    pay(), that takes

    amount

    as an input, reads the file and gets AmountBalance, print “Successful Transaction” when payment can be made or a message “You don’t have sufficient Balance in your wallet”.

  3. Write a function
    checkBalance(), that reads the file and gets AmountBalance, prints “Amaount Balance”

  4. Write a function
    recharge(), that takes “Enter Amount you want to recharge”, reads the file and gets AmountBalance, adds the new amount in AmountBalance, update the file, and prints “Success”



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here