Thread: Help

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

    Help !!!!


    Sorry guys, i am new at programming, so does anyone can help to answer this question.

    In the CalculateBonusInterest() function, the user needs to enter account information for the customer. Assume that every customer may not have all three accounts. If a customer has a saving account then the boolean variable S (for savings account) is set to 1 otherwise S is set to 0. For example, one customer may have all three accounts (i.e. S=1, C=1, and F=1) whereas other customer may have only Current and Fix Term Accounts (i.e. S=0, C=1, and F=1).

    I have read some documentation about boolean and condition but i couldnt solve this problem on my assessment.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Iran
    Posts
    149
    Rep Power
    139
    What is exactly your requirement?
    Regards,
    Dariyoosh
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0
    i dont know how to do it. =)

    First i need ask if the customer has Saving Account, Current account and fixed term account.

    If he says yes.. i do the calculation.
    if he says no i skip it , and ask for the next account.

    i have done something like that..

    AccountCheck = input('Does the customer have Saving Account [y/n]: ')

    if AccountCheck == 'y' or AccountCheck == 'Y':
    S = 1
    #Enter the amount of saving account
    SavBalance = float(input('Enter Saving Account Balance: $'))
    print('\n')

    #Calculate the Interest rate / total balance
    SavIntRate = SavBalance * SavingInterestRate / 100
    SavTotalBalance = SavBalance + SavIntRate
    else:
    S = 0
    SavBalance = ''
    SavIntRate = ''
    SavTotalBalance = ''

    # Check if the customer has Current account
    AccountCheck = input('Does the customer have Current Account [y/n]: ')

    if AccountCheck == 'y' or AccountCheck == 'Y':
    C = 1
    #Enter the amount of saving account
    CurBalance = float(input('Enter Current Account Balance: $'))
    print('\n')


    #Calculate the Interest rate / total balance
    CurIntRate = CurBalance * CurrentInterestRate / 100
    CurTotalBalance = CurBalance + CurIntRate
    else:
    C = 0
    CurBalance = ''
    CurIntRate = ''
    CurTotalBalance = 0

    # Check if the customer has Fixed term account
    AccountCheck = input('Does the customer have Current Account [y/n]: ')
    if AccountCheck == 'y' or AccountCheck == 'Y':
    F = 1
    #Enter the amount of Foxed term account
    FixedBalance = float(input('Enter Current Account Balance: $'))
    print('\n')

    #Calculate the Interest rate / total balance
    FixedIntRate = FixedBalance * FixedInterestRate / 100
    FixedTotalBalance = FixedBalance + FixedIntRate
    else:
    F = 0
    FixedBalance = ''
    FixedIntRate = ''
    FixedTotalBalance = 0

    if S == 0 and C == 0 and F == 0:
    print('The customer must have at least one account!')
    print('\n')
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,854
    Rep Power
    481
    The intersection of the set of careless programmers with the set of good programmers is empty. You're careless.

    Current account should be probably Checking account. Whether that's so or not, repeatedly asking
    AccountCheck = input('Does the customer have Current Account [y/n]: ')
    is certainly incorrect.


    Accounts have associated interest rates. These depend on the bank, not on the customer. Set the rates before you ask questions.

    Banks deal with numbers. Rates should be a numeric type, not string. What's with
    SavIntRate = '' ?

    Banks deal with decimal numbers. The numeric type should be decimal.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo