1 / 19

OOAD

OOAD. An Example. ACCOUNT. Static OOAD Diagram. acct # balance sec-code state. TRANS_REC. trans_type date_time amount teller_ID. has. withdrw dep prov_balance. (0,N). (1,1). ATM. atm #. req_withdrw req_dep req_balance req_int_rate. STD_ACCT. SAVINGS_ACCT. int_rate.

mbrett
Download Presentation

OOAD

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OOAD An Example

  2. ACCOUNT Static OOAD Diagram acct # balance sec-code state TRANS_REC trans_type date_time amount teller_ID has withdrw dep prov_balance (0,N) (1,1) ATM atm # req_withdrw req_dep req_balance req_int_rate STD_ACCT SAVINGS_ACCT int_rate add_on_interest prov_int_rate

  3. Scenario 1 ACCOUNT acct # balance sec-code state TRANS_REC trans_type date-time amount teller_ID withdrw dep ATM atm # req_withdrw req_dep withdrw / deposit create

  4. Scenario 2 ACCOUNT acct # balance sec-code state prov_balance ATM req_balance prov_balance

  5. ACCOUNT Scenario 3 acct # sec-code state ATM req_int_rate SAVINGS_ACCT int_rate prov_int_rate prov_int_rate

  6. OBJECT SPECIFICATION atm STRUCTURES EXTERNAL INPUTS / OUTPUTS INPUT request-for-withdrawal (atm #, acct #, amount, sec-code) INPUT request-for-deposit (atm #, acct #, amount) INPUT request-for-balance (acct #, sec-code) INPUT request-for-int-rate (acct #, sec-code) OUTPUT message-for-customer OUTPUT cash ATTRIBUTES atm # := identifies atm STATE-DIAGRAM

  7. SERVICES <atm> - SERVICE req_withdrw ( ) VARIABLE ok:= withdrawal possible? TRIGGERED BY INPUT request-for-withdrawal SEND MESSAGE TO account(acct #).withdrw (IN atm #, amount, sec-code; OUT ok) IF ok equal TRUE THEN BEGIN WRITE OUTPUT message-for-customer USE OUPUT cash(amount) END ELSE WRITE OUTPUT message-for-customer END-SERVICE req_withdrw.

  8. SERVICES <atm> - SERVICE req_dep ( ) VARIABLE ok:= deposit successful ? TRIGGERED BY INPUT request-for-deposit SEND MESSAGE TO account(acct #).dep (IN atm #, amount; OUT ok) IF ok equal TRUE THEN WRITE OUTPUT message-for-customer ELSE WRITE OUTPUT message-for-customer END-SERVICE req_dep.

  9. SERVICES <atm> SERVICE req_balance( ) VARIABLE ok:= access to balance possible? TRIGGERED BY INPUT request-for-balance SEND MESSAGE TO account(acct #).prov_balance (IN sec-code; OUT balance, ok) IF ok equal TRUE THEN WRITE OUTPUT message-for-customer (balance) ELSE WRITE OUTPUT message-for-customer END-SERVICE req_balance.

  10. SERVICES <atm> SERVICE req_int_rate( ) VARIABLE ok:= access to int-rate possible? TRIGGERED BY INPUT request-for-int-rate SEND MESSAGE TO savings_acct(acct #).prov_int_rate (IN sec-code; OUT int-rate, ok) IF ok equal TRUE THEN WRITE OUTPUT message-for-customer (int-rate) ELSE WRITE OUTPUT message-for-customer END-SERVICE req_int_rate. END SPECIFICATION atm.

  11. OBJECT SPECIFICATION account STRUCTURES account has (0,N) trans_rec account specialized_into std_acct account specialized_into savings_acct EXTERNAL INPUTS / OUTPUTS ATTRIBUTES acct # := identifies atm balance := current balance on account in $ sec-code := authorization code state := active, closed STATE-DIAGRAM active closed

  12. SERVICES <account> - SERVICE withdrw ( IN atm #, amount, req-sec-code; OUT ok) IF (state = active) & (req-sec-code = sec-code) & (amount < balance) THEN BEGIN <transaction ok> ok <= TRUE balance <= balance - amount SEND MESSAGE TO trans-rec.create (IN “withdrawal”, current date&time, amount, atm #; OUT) END ELSE ok<= FALSE END-SERVICE withdrw.

  13. SERVICES <account> - SERVICE dep ( IN atm #, amount; OUT ok) IF (state = active) THEN BEGIN <transaction ok> ok <= TRUE balance <= balance + amount SEND MESSAGE TO trans-rec.create (IN “depositl”, current date&time, amount, atm #; OUT) END ELSE ok<= FALSE END-SERVICE dep.

  14. SERVICES <account> - SERVICE prov_balance ( IN req-sec-code; OUT result_balance, ok) IF (state = active) & (req-sec-code = sec-code) THEN BEGIN <transaction ok> ok <= TRUE result_balance <= balance END ELSE ok<= FALSE END-SERVICE prov_balance. END SPECIFICATION account.

  15. OBJECT SPECIFICATION std_acct STRUCTURES std_acct is-a account EXTERNAL INPUTS / OUTPUTS ATTRIBUTES STATE-DIAGRAM SERVICES END SPECIFICATION std_acct

  16. OBJECT SPECIFICATION savings_acct STRUCTURES savings_acct is-a account EXTERNAL INPUTS / OUTPUTS ATTRIBUTES int_rate := currently valid interest rate STATE-DIAGRAM

  17. SERVICES <savings_acct> - SERVICE prov_int_rate ( IN req-sec-code; OUT result_int_rate, ok) IF (state = active) & (req-sec-code = sec-code) THEN BEGIN <transaction ok> ok <= TRUE result_int_rate <= int_rate END ELSE ok<= FALSE END-SERVICE prov_int_rate.

  18. SERVICES <savings_acct> - SERVICE add_on_interest ( ) VARIABLE interest := used to calculate interest TRIGGERED BY TIME (end-of-month) calculate interest from ( balance & int-rate ) balance <= balance + interest END-SERVICE add_on_interest. END SPECIFICATION savings_acct.

  19. OBJECT SPECIFICATION trans_rec STRUCTURES trans_rec has <belongs to> (1,1) account EXTERNAL INPUTS / OUTPUTS ATTRIBUTES trans_type := withdrawal or desposit date_time := date & time of transaction amount := amount used in trans_type teller_ID := ID of accessing entity (teller, atm) STATE-DIAGRAM SERVICES - SERVICE create is standard create. END SPECIFICATION trans_rec.

More Related