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 18:10
Ahot wire operates at a temperature of 200°c while the air temperature is 20°c. the hot wire element is a tungsten wire of 5 um diameter and 2 mm in length. plot using excel current, heat transfer and heat generated by the wire for air velocity varying from 1-10 m/s in steps of lm/s? matlab the sensor voltage output, resistance, or assume nu 0.989 re033pr13 take air properties at tr (200°c20°c)/2 = 110°c properties of tungsten: c 0.13 kj/kg.k 3 p 19250 kg/m k (thermal conductivity) = 174 w/m.k
Answers: 2
question
Engineering, 04.07.2019 19:10
Asteel wire of 2 mm diameter is fixed between two points located 2 m apart. the tensile force in the wire is 250n, if its density of steel is given by 7830 kg/m3 the fundamental frequency of vibration hz? ?
Answers: 3
question
Engineering, 04.07.2019 19:10
Acircular aluminum shaft mounted in a journal is shown. the symmetric clearance gap between the shaft and journal is filled with sae 10w-30 oil at t 30°c. the shaft is caused to turn by the attached mass and cord. develop and solve a differential equation for the angular speed of the shaft as a function of time.
Answers: 2
question
Engineering, 04.07.2019 19:20
Determine the time of the day and month of the year at which the peak sensible cooling load occurs for a top floor, north-eastern corner room of an office building in durban for the following conditions: floor area: 8 x 8 x 3 m east and north walls: 115 mm face brick (outside), 20 mm air space, 115 mm ordinary brick (inside) with 15 mm plaster roof construction: suspended plasterboard ceiling, 450 mm air space, 150 mm concrete, 75mm screed, waterproofing no heat transfer across other surfaces window area 3x 1,5 m high in north wall only. ordinary glass with venetian blinds. lights and occupants : from 07: 00 to 18: 00 average light density: 25 w/m2 number of occupants : 5 seated, light office work room temperature 24°c
Answers: 3
You know the right answer?
Homework: Chapter 23a Using our implementation of ChargeCard. py as the base class, write a RewardsC...
Questions
Questions on the website: 13722362