You are tasked with the responsibility of writing a tool for generating Java code from UML. The class diagram provides p
Posted: Tue May 24, 2022 8:18 am
The following outline code has been generated from the tool: public class S2 extends S1 { } public void buy (Int Amount, X _this) { _this.setState(new S4()); _this.setop1(_this.ret_op1()+Amount); } public void sell (Int Amount, X _this) { _this.setState(new S3()); _this.setop1(_this.ret_op1()-Amount); } public void crash (X _this) { _this.setState(null); }
In the following, choose all statements which are true. Ⓒa. X==Position. O b. X==Holding. S1==Available, S2==Reduce, S3==Accumulate. d. Operations of the Position class should include inc, available, buy, reduce, and crash. De Operations of the Position class should include crash, inc, buy and sell. O f. Since the state machine contains loops, the number of states is infinite. 8- 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. Oh. $1==State (where State is an abstract class), S2==Accumulate, $3==Reduce, S4==Accumulate.