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
Easy 25 points answer what is it called that you use only 1 and 0 like this 1010010011001100011110001010010101001010101010010101
Arlecino [84]
Binary. Is the correct answe
3 0
3 years ago
I need help quick Which of the following principles is not part of the constitution?
laila [671]

Answer:

Confederalism is not in the constitution it was adopted later.

Explanation:

5 0
3 years ago
What are the reasons why organizations opt for a certificate
Nata [24]

Answer:

Because it helps you prove that you're you to third parties who wouldn't know otherwise. A CA helps you to establish trust with others because they're trusted for issuing valid, reliable certificates — and that trust is integral to public key infrastructure (PKI).

Explanation:

with this info I believe it is a A and C

6 0
2 years ago
In order to manage information for a company, your website would need a/an
Eva8 [605]
The answer is database.
3 0
2 years ago
Which of these is NOT an advantage of the impact of computer careers.
nikdorinn [45]
I believe the answer could be the first choice. I'm not quite sure, though
4 0
3 years ago
Read 2 more answers
Other questions:
  • Select all that apply. Hyperlinks can appear as: words pictures symbols trademarks
    12·2 answers
  • ________ is an open-source program supported by the Apache Foundation that manages thousands of computers and implements MapRedu
    5·1 answer
  • My ar goal is 16.3 what percent am i at if i have 3 points??
    8·1 answer
  • Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
    11·1 answer
  • I have lost the watch (that,which) you gave me​
    12·1 answer
  • 5.2
    8·1 answer
  • Cómo se hacían antes las cosas que hoy en día se hacen apoyadas en aplicaciones y software?
    10·1 answer
  • What is modern? explain​
    11·1 answer
  • Please help me on this match all this up i’ll give you brainlist
    13·2 answers
  • Writing queries in sql to compile data from a database is related to the physical level of databases true or false?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!