Tags: %TAGME{ tpaction="" web="Main" tag="" }% view all tags

Account and Customer Class

Moodle Link

Group 1

https://repl.it/join/rqeimybu-jimskon

Group 2

https://repl.it/join/mgkdzcag-jimskon

Group 3

https://repl.it/join/xhiivcuk-jimskon

Group 4

https://repl.it/join/mnzxvwwq-jimskon

Group 5

https://repl.it/join/dxfanbje-jimskon

Template

https://repl.it/@JimSkon/ClassBank

Consider a class to represent bank accounts:

https://repl.it/@JimSkon/ClassBank

Consider an alternative design. We actually have two classes, accounts and customers.

An account has the following:

  • An account name
  • An associated customer (not just a name)
  • A balance
  • An interest rate (0-100)

And we can do the following with an account (methods):

  • __init__(self, name, cust, balance=0, interest=0)
  • withdraw(self, amount)
  • deposit(self, amount)
  • getBalance(self)
  • getName(self)
  • getCust(self)

where cust is a Customer object (below), not a customer name

And we also have a customer withthe following:

  • Name
  • Address
  • Phone
  • Social Security Number

And the following methods:

  • __init__(self, name, address, phone, SSN)
  • getName(self)
  • getAddress(self)
  • getPhone(self)
  • getSSN(self)
  • setName(self, name)
  • setAddress(self, address)
  • setPhone(self, phone)
  • setSSN(self, ssn)

Step 1

Create and test both classes. You will need a new file for customer.

Step 2

Add a menu with the following options:

  1. Add a customer
  2. List customer
  3. Add an account
  4. List all accounts
  5. List account by customer
  6. Pick an account and deposit
  7. Pick an account and withdraw
  8. Add monthly interest to all accounts

The trick is how to add an account since it refers to a customer. WE have to add a customer first, then have a way to pick a customer for an account. How do we doo this?

Also - how to we pick an account for deposit and withdraw? (Hint, we need to pick a customer first, then the account)

Complete the following system, and turn in on Moodle.

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2020-04-08 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback