subject
Engineering, 16.04.2020 04:03 webbjalia04

Homework: Chapter 23a Using our implementation of ChargeCard. py as the base class, write a RewardsChargeCard class in a file named RewardsChargeCard. py) that simulates a credit card that rewards its users by giving them some percentage of money back. Formal Specifications A RewardsChargechard must use ChargeCard as its base class. Such a card has a reward rate - the percentage of money the user gets back as rewards for each charge transaction. The rewards are accumulated until used. When rewards are used, the accumulated reward amount is deposited into the card and accumulated reward amount is reset to zero. A ChargeCard must support the following calling syntaxes: Β· Constructor The constructor should accept two required parameters, designating the spending limit on the card and the reward rate (as a float). Additionally, the constructor must accept an optional parameter that designates an initial balance with the balance being 0 by default). For example, the syntax # using default value of balance card = RewardsChargeCard(1000, 0.01) would create a new card, with spending limit of 1000, reward rate of 0.01, and an initial balance of zero. # specifying the value of balance explicitly card = RewardsChargeCard(1000, 0.01, 100) would create a new card, with a spending limit of 1000, reward rate of 0.01, and an initial balance of 100. β€’ charge(amount) The RewardsChargeCard should override the parent class implementation of this method by: β€’ First calling the parent class implementation of charge (amount) o Updating the value of accumulated rewards. Each charge transaction earns (amount * reward rate) toward the accumulated rewards. Rewards will only be added on valid transactions (if the charge is accepted). o Returning True if the amount does not exceed the sum of the current card balance and the card limit, and False otherwise. For example, the following operations would result in the accumulated reward value 10. card=RewardChargeCard(10000, 0.01) card. charge(1000) If the charge is invalid (over the limit) the rewards are not added. For example, the following operations would result in no rewards card = RewardChargeCard (10000, 0.01, 1000) # inital balance is 1000 card. charge (10000) # charge is over the limit+balance, invalid operation, no rewards β€’ getRewards A call to this method returns the value of accumulated rewards. β€’ useRewards() A call to this method applies the currently accumulated rewards to the balance and then sets the rewards total to 0. Applying rewards to the balance is identical to depositing money to the card, and a convenient way to apply accumulated rewards to the balance is by using the parent class deposit(amount) method and then setting the reward total to 0.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 08:10
Which of the following is an easy way to remember the modified β€œx” tire rotation? a. nondrive wheels straight, cross the drive wheels b. drive wheels straight, cross the nondrive wheels c. drive wheels crossed, nondrive wheels straight d. drive wheels crossed, nondrive wheels crossed
Answers: 1
question
Engineering, 04.07.2019 12:10
On a average work day more than work place firs are reorted
Answers: 1
question
Engineering, 04.07.2019 18:20
For each of the following process: a) sketch the p-v diagram, b)sketch t-s diagram, c) sketch t-v diagram, d) sketch the boundary work on one of the diagrams (a, b or c) and e) sketch the reversible heat transfer on one of the diagrams (a, b or c): 1- isobaric process from compressed liquid to superheated vapor 2- isothermal process from compressed liquid to superheated vapor 3- isentropic process from compressed liquid to superheated vapor
Answers: 3
question
Engineering, 04.07.2019 18:20
Amixture of slurry and mud is to be pumped through a horizontal pipe of diameter 500 mm. the fluid behaves as a bingham plastic with a yield stress of 30 pa and viscosity 0.04 pa.s. describe the effects of the shear stress through a transverse section of the pipe by plotting the variation in shear stress and velocity profile: (i) just before the slurry starts to move (ii) as the slurry flows when the pressure gradient is double that in part (i)
Answers: 3
You know the right answer?
Homework: Chapter 23a Using our implementation of ChargeCard. py as the base class, write a RewardsC...
Questions
question
Mathematics, 11.01.2020 02:31
question
Mathematics, 11.01.2020 02:31
question
Mathematics, 11.01.2020 02:31
question
English, 11.01.2020 02:31
question
Biology, 11.01.2020 02:31
question
History, 11.01.2020 02:31
question
Mathematics, 11.01.2020 02:31
question
Chemistry, 11.01.2020 02:31
question
Business, 11.01.2020 02:31
question
Mathematics, 11.01.2020 02:31
Questions on the website: 13722363