讲解:CS174A、Database Systems、SQL、SQLC/C++|Haskell

CS174A Fundamentals of Database Systems Fall 2019COURSE PROJECT 1 INTRODUCTIONYou have been hired to develop a prototype account management system for Debts Rus State Bank. Thesystem is to manage all savings, checking, and pocket accounts at the bank for customers of Debts Rus. Thisincludes the following tasks.• Maintaining balance information for all customer accounts,• Maintaining information on bank customers, the owners of the accounts,• Processing transactions (deposits, withdrawals, payments, etc.),• Generating monthly reports and updating accounts with monthly interest, and• Providing a simulated ATM-App (Automated Teller Machine-Application) interface.Your system is to be implemented within the Oracle DBMS environment using Java and the JDBC interfaceto the Oracle DBMS.2 DETAILS2.1 AccountsAn account is a repository of money owned by one or a set of customers. If there is more than one owner, oneof them is designated as the primary owner (who, among other things, will receive monthly statements) andall other owners are co-owners who will have all owner’s privilege except for receiving month statements.Associated with each account is a unique account ID number (an integer), and a list of transactions madeduring the month. Also associated with each account is a bank branch name in which the account is held.Accounts come in three flavors: checking, savings, and pocket. There are two sub-flavors of checkingaccounts: student checking and interest checking. There is only one kind of savings accounts and one kindof pocket accounts.The following rules apply to all accounts:1. When a checking or savings account is first created, it must have a balance of at least $1,000 (this shouldbe recorded in the transaction history as a deposit).2. When a pocket account is created the customer must already have a checking or savings account with apositive balance. The customer also selects the account (checking or savings) to be linked to the pocketaccount.3. No transaction can make an account balance to go below $0.00; every transaction that removes morethan the available balance must fail.4. Each transaction that makes a checking or savings account balance to $0.01 or less automatically closesthe account. When an account is closed, the account is not removed from the database until after a finalstatement is generated (at the end of the month). No transactions (including deposits) are permitted on aclosed account.5. At the end of each month, all open accounts earn interest on their balances. The rate of interest varieswith the type of account.12.2 Checking AccountsIn addition to the general account rules, all checking accounts observe the following rules:1. Interest checking has an initial 3.00% annual rate (for simplicity, the monthly interest rate is just theannual rate divided by 12) but can be changed. It should be simple to change these values in yourprototype system (bank policies change quite often). Student checking earns no interests, i.e., has a fixed0.00% annual rate.2. The following transactions are valid on a checking account: deposit, withdrawal, transfer, wire, writecheck,and accrue-interest.2.3 Savings AccountsSavings accounts observe the following rules in addition to the general account rules:1. The initial annual interest rate is 4.80%.2. The following transactions are valid on a savings account: deposit, withdrawal, transfer, wire, andaccrue-interest. Note that no checks can be written for a savings account.2.4 Pocket AccountsPocket accounts are used to make flexible payments (e.g., from cell phones) to vendors, or other customer’spocket accounts. The general account rules and the follow rules apply:1. The interest rate is always 0.0%.2. A flat $5 monthly fee is applied on the first transaction of the month. The monthly fee is waived if thereare no transactions in the month,3. The following transactions are valid on a savings account: top-up, purchase, collect, and pay-friend.2.5 CustomersA customer is an individual with a name, a (unique) tax identification number, and an address. Everycustomer has a set of (jointly) owned accounts. A customer should be only kept in the system if he or sheowns one or more accounts.Also associated with each customer is a unique PIN (Personal Identification Number), which is a 4-digitstring (i.e., leading 0 is acceptable). The PIN is used by the customer to access the accounts she/he ownsusing an ATM-App (interface). The PIN should be private data: it should not be possible to write a program(e.g., SQL) that reads the PIN value for a customer. Rather, only two functions should have access to anaccount’s PIN, VerifyPin(PIN) and SetPin(OldPIN, NewPIN). The function VerifyPin(PIN) returns true ifPIN is the correct PIN for the customer. SetPin(OldPIN, NewPIN) changes a customer’s PIN to NewPIN, ifOldPIN is the customer’s current PIN. When a new customer is created in the system, the PIN is initializedto 1717.2.6 TransactionsTransactions are actions that move money into and out of accounts, and from one account to another. Atransaction can be generated by interaction of a customer with an ATM-App, or by an action taken by abank teller.The following transaction types are allowed in the system:2Deposit: Add money to the checking or savings account balance.Top-Up: Move a specified amount of money from the linked checking/savings account to the pocket account.Withdrawal: Subtract money from the checking or savings account balance.Purchase: Subtract money from the pocket account balance.Transfer: Subtract money from one savings or checking account and add it to another. A transfer can onlyoccur between two accounts that have at least one owner in common. If the transfer was requested by acustomer, she or he must be an owner of both accounts. Furthermore, the amount to be moved shouldnot exceed $2,000.Collect: Move a specified amount of money from the pocket account back to the linked checking/savingsaccount, there will be a 3% fee assessed.Pay-Friend: Move a specified amount of money from the pocket account to a specified customer’s pocketaccount.Wire: Subtract money from one savings or checking account and add it to another. The customer thatrequests this action must be an owner of the account from which the money is subtracted. There is a 2%fee for this action.Write-Check: Subtract money from the checking account. Associated with a check transaction is a checknumber. (Note that a check cannot be written from all account types.)Accrue-Interest: Add money to the checking or savings account. The amount added is the monthly interestrate times the average daily balance for the month (e.g., an account with balance $30 for 10 days and $60for 20 days in a 30-day month has an average daily balance of $50, not $45!). Interest is added at the endof each month.AssociCS174A代写、Database Systems代做、SQated with every transaction is the date of the transaction and the account(s) involved (in additionto any information specific to the transaction; e.g., check number). This information will be included in themonthly statement for each account.Transactions may fail for various reasons. For example, a transaction fails if any of the accounts involvedare closed or if more money is deducted than is available in the account.All successful transactions on an account should be recorded for the account and printed in the monthlystatement for the account.2.7 ATM-App InterfaceYour system needs to provide a simulated ATM-App (Automated Teller Machine or mobile application)interface. (For simplicity, these two interfaces are combined for this project.) The ATM-App interfaceshould query for a PIN. If the PIN is successfully verified, the ATM-App should allow the customer to makeany of the following transactions:• Deposit, top-up,• Withdrawal, purchase,• Transfer (between accounts with a common owner only), collect,• Wire, pay-friend.If the customer owns more than one account, she should be prompted for the account(s) the transactionshould access.3Optionally, you may want to include a “quick cash” option, which automatically withdraws some preselectedamount(s) from a pre-selected account. If there is no pre-selected amount or account, no withdrawalshould occur. Similarly, a “quick refill” option can be provided for pocket accounts.2.8 Bank Teller InterfaceThe Bank Teller Interface allows bank employees to manage customer accounts. The following optionsshould be available:Enter Check Transaction: Submit a check transaction for an account.Generate Monthly Statement: Given a customer, do the following for each account she owns (includingaccounts which have closed but have not been deleted): generate a list of all transactions which haveoccurred in the last month. This statement should list the names and addresses of all owners of theaccount. The initial and final account balance is to be included. If the sum of the balances of theaccounts of which the customer is the primary owner exceeds $100,000, a message should be includedin the statement to warn the customer that the limit of the insurance has been reached.List Closed Accounts: Generate a list of all accounts which have closed in the last month.Generate Government Drug and Tax Evasion Report (DTER): By federal law, deposits over $10,000for a single customer in all (owned or jointly owned) accounts within one month must be reported to thegovernment. Generate a list of all customers which have a sum of deposits, transfers and wires duringthe current month, over all owned accounts (active or closed), of over $10,000. (How to handle jointaccounts?)Customer Report: Generate a list of all accounts associated with a particular customer and indicate whetherthe accounts are open or closed.Add Interest: For all open accounts, add the appropriate amount of monthly interest to the balance. Thereshould be a record in your database that interest has been added this month. So a repeated “Add Interest”transaction would report a warning and do nothing else.Create Account: Given an account type and other necessary information (e.g. owners, initial balance),create a new account with the specified characteristics. Note that this operation may introduce newcustomers to the bank. You may consider a create customer operation, but as far as the bank operationsare concerned, customer creation is a part of account creation.Delete Closed Accounts and Customers: Remove from the database all closed accounts and remove allcustomers who do not own any accounts (because their accounts have closed).Delete Transactions: Delete the list of transactions from each of the accounts, in preparation for a newmonth of processing.2.9 Set Dates and Interest RatesThe following operations should also be provided in your system. They may not a functional part of yoursystem but they are needed to test and debug your system.• Set a new date, you can assume that the new date is later than all dates recorded in the database, and• Set a new interest rate for a given type of accounts.You may assume that the bank is open every day.43 REQUIREMENTSYour prototype system should have user interface(s) for the ATM-App and Bank Teller interfaces. It is notnecessary to have your interfaces accessible from a web browser, even though access through the web seemslogical and desirable. In designing the GUIs of your system, keep in mind the principle of “simple” and“functional”. You will not earn extra credits with fancy GUIs. On the contrary, if your system does notfunction as specified, you will lose points.You must store all information of your system in a database system managed by the Oracle DBMS. Thatis when your system is not running or crashed or shutdown, all data are in the database and nothing is storedin any files. When your system restarts, all previous actions done on your system must be remembered.Again, you should not use files. Your system should be implemented in Java using JDBC to connect to yourdatabase managed by the Oracle DBMS.The course project is to be completed by each group consisting of 2 students. Everyone in the groupis expected to know all details of the implementation up to the level of being able to answer questionsconcerning design decisions.4 EARLY PROJECT REPORTEach group should submit an early project report by Monday, November 4. The report has to address theissues in making major design decisions. In particular, you should discuss the following points that will helpunderstanding the requirements of the project and main steps towards completing the project.1. Identify as many integrity constraints as you can on your initial ER diagram. You may describe theconstraints in English.2. Design an ER diagram for the application described in the project and express as many integrity constraintsyou have identified as possible.3. Translate the ER diagram into relation schemas and do not forget the integrity constraints you haveidentified.4. Indicate which integrity constraints that your relational database schema is able to incorporate; identifyadditional integrity constraints if possible.5. Discuss briefly how you will deal with a violation of each of the integrity constraints identified.6. Provide an initial system design. You can choose appropriate means to describe your system design, e.g.,class diagrams, diagram of functional components, etc.7. List the task divisions and list each member’s responsibility.Please typeset your report (you may draw figures by hand), a revised version of your report will be a partof the final project report.5 Project EvaluationProject evaluation of all teams will be conducted in the 10th week, i.e., during the week of December 2.Details will be announced later.5转自:http://www.daixie0.com/contents/15/4389.html

你可能感兴趣的:(讲解:CS174A、Database Systems、SQL、SQLC/C++|Haskell)