Page 1 of 1

Question 1 Not yet answered Marked out of 8.00 P Flag question You are tasked with the responsibility of writing a tool

Posted: Tue May 24, 2022 8:21 am
by answerhappygod
Question 1 Not Yet Answered Marked Out Of 8 00 P Flag Question You Are Tasked With The Responsibility Of Writing A Tool 1
Question 1 Not Yet Answered Marked Out Of 8 00 P Flag Question You Are Tasked With The Responsibility Of Writing A Tool 1 (69.81 KiB) Viewed 13 times
Question 1 Not yet answered Marked out of 8.00 P Flag question You are tasked with the responsibility of writing a tool for generating Java code from UML. The class diagram provides partial information on the attributes of a trading position. Missing from the diagram are the operations. A state diagram is also shown of some possible states for the trading position. The state diagram shows that a position is held if its price is initially less than a certain value or is made available to sell or buy otherwise. Once available to buy/sell the position can be increased or decreased. State transitions can terminate by way of a market crash. Trading Position inco[price>=v11/price++ buy() Accumulate buy() Holding inc()[price<v1]/price++ } crash() Available crash buy0 crash() crash Position + id: String [1] + price: Real [1] The following outline code has been generated from the tool: public class S1 extends S2 { public void buy (Int Amount, Z_this) { _this.setState(new S3()); _this.setop1( this.ret_op1()+Amount); } public void sell (Int Amount, Z_this) { this.setState(new S4()); _this.setop1( this.ret_op1()-Amount); } public void crash (Z_this) { _this.setState(null); } sell( sell() Reduce sell(

a. S1==Available, S2==State (where State is an abstract class), S3==Accumulate, S4==Reduce. b. Since the state machine contains loops, the number of states is infinite. ⒸC. Y==Position. d. S1==Reduce, S2==Holding, S3==Available. e. Operations of the Position class should include crash, inc, buy and sell. f. The Position class should have operations ret_op1 which returns the amount invested in a position and setop1 which increases the investment by a specified amount. 8. Y==Available. h. Operations of the Position class should include inc, available, accumulate, reduce, and crash.