1 / 20

OOAD

OOAD. An Example. Account. acct # balance sec-code state. Trans_Rec. trans_type date_time amount teller_ID. has . withdrw dep prov_balance. 0..*. 1. Atm. atm #. req_withdrw req_dep req_balance req_int_rate. Std_Acct. Savings_Acct. int_rate. add_on_interest

lovette
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 acct # balance sec-code state Trans_Rec trans_type date_time amount teller_ID has withdrw dep prov_balance 0..* 1 Atm atm # req_withdrw req_dep req_balance req_int_rate Std_Acct Savings_Acct int_rate add_on_interest prov_int_rate abstract (Static) Class diagram

  3. ACCOUNT Static OOAD Diagram – other notations 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

  4. Scenario 1 ACCOUNT abstract 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

  5. Scenario 2 ACCOUNT abstract acct # balance sec-code state prov_balance ATM req_balance prov_balance

  6. ACCOUNT abstract Scenario 3 acct # sec-code state ATM req_int_rate SAVINGS_ACCT int_rate prov_int_rate prov_int_rate

  7. 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

  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. 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 Informal closed

  13. 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.

  14. 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.

  15. 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.

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

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

  18. 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.

  19. 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.

  20. 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