1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kobusy [5.1K]
3 years ago
9

Banking Account

Computers and Technology
1 answer:
satela [25.4K]3 years ago
4 0

Answer:

Here is the Python script solution.

Explanation:

#!/usr/bin/python

"""Types of bank accounts"""

# Assignment:

# Bank Account Manager - Create a class called Account which will be an abstract

# class for three other classes called CheckingAccount, SavingsAccount and

# BusinessAccount. Manage credits and debits from these accounts through an ATM

# style program.

from __future__ import print_function

def pct_to_dec(num):

"""Returns decimal version of percent"""

dec = float(num) / 100

return dec

class Account(object):

"""Creates an Account"""

def __init__(self, balance, int_rate, act_type, min_balance, **kwargs):

self.balance = balance

self.int_rate = int_rate

self.act_type = act_type

self.min_balance = min_balance

super(Account, self).__init__(**kwargs)

def __str__(self):

"""Returns formatted account type and balance"""

# Charge $25 fee if balance drops below minimum

if self.balance < self.min_balance:

self.balance -= 25

# Add interest

self.balance += round(self.balance * pct_to_dec(self.int_rate), 2)

return '{0}: ${1}'.format(self.act_type, self.balance)

class CheckingAccount(Account):

"""Creates a CheckingAccount Account"""

def __init__(self, **kwargs):

super(CheckingAccount, self).__init__(**kwargs)

class SavingsAccount(Account):

"""Creates a SavingsAccount Account"""

def __init__(self, **kwargs):

super(SavingsAccount, self).__init__(**kwargs)

class BusinessAccount(Account):

"""Creates a BusinessAccount Account"""

def __init__(self, **kwargs):

super(BusinessAccount, self).__init__(**kwargs)

# pylint: disable=C0103

ca1 = CheckingAccount(balance=500, int_rate=0.25, act_type='Checking Account',

min_balance=0)

sa1 = SavingsAccount(balance=50, int_rate=0.50, act_type='Savings Account',

min_balance=0)

ba1 = BusinessAccount(balance=4000, int_rate=0.75, act_type='Business Account',

min_balance=5000)

# Month #1 statement, initial deposits plus interest

print(ca1)

print(sa1)

print(ba1)

print('-------------')

# Month #2 statement plus interest

# Make deposit into checking

setattr(ca1, 'balance', (ca1.balance + 1000))

# Withdraw from checking

setattr(ca1, 'balance', (ca1.balance - 500))

# Make a deposit into savings

setattr(sa1, 'balance', (sa1.balance + 100))

print(ca1)

print(sa1)

print(ba1)

print('-------------')

# Month #3 statement plus interest

# Make deposit into checking

setattr(ca1, 'balance', (ca1.balance + 2500))

# Withdraw from checking

setattr(ca1, 'balance', (ca1.balance - 700))

# Make a deposit into savings

setattr(sa1, 'balance', (sa1.balance + 100))

# Make a deposit into business

setattr(ba1, 'balance', (ba1.balance + 1000))

print(ca1)

print(sa1)

print(ba1)

You might be interested in
Which access object cannot be used to enter or edit data
kap26 [50]

Answer:

Should be B. table !

6 0
1 year ago
Read 2 more answers
Which task can a company perform with intranets
Irina-Kira [14]

Answer:

C.) store data securely would be my choice

Hope This Helps!  Have A Nice Day!!

6 0
2 years ago
Which of the following statements about the use of desktop publishing software is true
VLD [36.1K]
What did you do when you got to school tomorrow and then again I don't want it
4 0
2 years ago
Comment on the following 2 arrays. int *a1[8]; int *(a2[8]); a1 is pointer to an array; a2 is array of pointers a1 is pointer to
Hitman42 [59]

Answer:

The answer is "a1 and a2 is an array of pointers".

Explanation:

In this question, A collection of pointers refers to an array of elements where each pointer array element points to a data array element. In the above-given statement, the two-pointer type array "a1 and a2" is declared that holds the same size "8" elements in the array, and each element points towards the array's first element of the array, therefore, both a1 and a2 are pointer arrays.

5 0
3 years ago
Although the first GPS satellite was put into orbit in the ___________, GPS did not provide global coverage until _______.
Ilia_Sergeevich [38]
February 22 1978 and 1992 
5 0
3 years ago
Other questions:
  • Im trying to learn c# for unity does anyone know any good sources
    10·1 answer
  • There are several vehicles in a parking lot. Some of them are motorcycles
    8·2 answers
  • Approximately what percent of desktop PCs are used for work-related purposes?
    12·1 answer
  • Which of these is a cultural form? A. Art B. Food C. Clothes D. All of the above
    8·2 answers
  • Discuss a situation in which you might want to use a floating-point number with a fractional part for a loop control variable. W
    5·1 answer
  • Which email client feature allows you to store the names and information of people you contact frequently?
    5·1 answer
  • A ___ is an organized collection of data in digital format that helps users to keep
    5·1 answer
  • Being nice take the points​
    9·1 answer
  • write a pay-raise program that requests a person's first name, last name, and current annual salary, and then displays the perso
    6·1 answer
  • Can someone send me reference on communication, importance , communication cycle , pros and cos​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!