2) Write Shopping Cart class to implement a shopping cart that you…
Question Answered step-by-step 2) Write Shopping Cart class to implement a shopping cart that you… 2) Write Shopping Cart class to implement a shopping cart that you often find on websites where you could purchase some goods. Think about what things you could store in a cart and also what operations you could perform on the cart.To simplify matters, you could consider the website to be an electronics e-store that has goods like flat-panel TVs, boomboxes, iPods, camcorders, and so on. 11) Design a class called Sentence that has a constructor that takes a string representing the sentence as input. The class should have the following methods:get_first_wordget_all_wordsreplace(index, new word)—Change a word at a particular index to”new_word”. For example, if sentence is “I’m going back.” and set word at index(2,”home”), then sentence becomes “I’m going home.”13) Create class for a bank account with attributes: user’s name, password, and account balance. The users account balance will default to $0 if no inital value is provided. Include three methods: withdraw, deposit, and print account info and balance. All methods must require the correct password and print an error message if the password is incorrect. NOTE FOR QUESTION 13: The Banking class should be a generic class that can be used to create different bank account objects. Do not attempt to manually assign values to the attributes. Consider making use of def __init__( ): to define the class attributes during object instantiation. The security check should be able to dynamically check for password. It should reference the password value that is defined during object instantiation. Do not try to hardcode a password value to check for (e.g. if password == “123”:). Computer Science Engineering & Technology Python Programming CSIT 112 Share QuestionEmailCopy link Comments (0)


