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, 03.07.2019 14:10
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
question
Engineering, 04.07.2019 16:10
The force on a cutting tool are 2600n vertically downward and 2100 horizontal. determine the resultant force acting on the tool and the angle at which it acts.
Answers: 1
question
Engineering, 04.07.2019 16:10
An electrical motor raises a 50kg load at a construct velencity .calculate the power of the motor, if it takes 40sec to raise the load through a height of 24m(take g =9.8n/g)
Answers: 2
question
Engineering, 04.07.2019 18:10
Aloaded platform of total mass 500 kg is supported by a dashpot and by a set of springs of effective stiffness 72 kn/m. it is observed that when the platform is depressed through a distance x = 12.5 cm below its equilibrium position and then released without any initial velocity; it reaches its equilibrium position in the shortest possible time without overshoot. find the position and velocity of the loaded platform 0.10 sec. after its release. if a further load of 400 kg is added to the platform, find, i) the frequency of damped vibrations, and i) the amplitude of vibration after 2 complete oscillations, given that the initial amplitude is 15 cm.
Answers: 1
You know the right answer?
Homework: Chapter 23a Using our implementation of ChargeCard. py as the base class, write a RewardsC...
Questions
question
Mathematics, 04.10.2021 14:00
question
Engineering, 04.10.2021 14:00
question
Mathematics, 04.10.2021 14:00
question
Chemistry, 04.10.2021 14:00
question
English, 04.10.2021 14:00
Questions on the website: 13722362