示例#1
0
import os
from donor_models import Donor, DonorCollection
import sys

# initialize with a set of donors
donors_db = [
    Donor('Adam A', [100, 200]),
    Donor('Betty', [100, 200, 200]),
    Donor('Carl C', [100]),
    Donor('Ed E', [50, 100, 25]),
    Donor('Frank F', [50])
]

donors_dict = DonorCollection()
for donor in donors_db:
    donors_dict.new_donor(donor)


def quit_function():
    """
    This function terminates the program.
    """
    exit()


def default():
    """
    This function prompts user of invalid entry and asks for re-entry. Returns control back to program.
    """
    print('************************************************************')
    print('Incorrect input. Select from given menu items and try again!')
示例#2
0
from donor_models import Donor as D
from donor_models import DonorCollection as DC
import sys

#Establish existing donor list
donors = [
    D("Krystal Perez", [50.00, 250.00]),
    D("Eddie Lau", [32.50]),
    D("Jimmy Jack", [200.00, 350.00, 400.00]),
    D("Grace Cool", [120.00, 75.00]),
    D("Adriel Molina", [45.00, 450.00])
]
donor_collection = DC()
for donor in donors:
    donor_collection.new_donor(donor)


#Opening prompt function
def opening_screen():
    #Tell the user what their options are. Ask for an input.
    print('')
    print('Welcome to the mailroom tool. Please select an action:')
    print('1 - Send a Thank You')
    print('2 - Create a Report')
    print('3 - Send letters to all donors')
    print('4 - Quit')
    #Send user input back to main function to be analyzed.
    return input()


def list_donors(donor_collection):