Question
Java Question
What kind ofdata type that JOptionPane.showInputDialog method will create upon user input? ANS (I) Write down statement that converts a String integer-numeric-data-type variable: sHeight to integer numerical value type Write down statement that converts a String double-numeric-data-type variable: sCost to double numerical value type named: cost. ANS (3) ANS (I): 7 ANS (2): ANS (3) You try to extend a class which has several private instance variables and adequate accessing methods are provided, (1) (2) what kind of class methods you should use to update the private variable values? ANS (1) what kind of class methods you should use to fetch the private variable values? ANS (2) ANS (1):-mutate ANS (2): mnlr with the encansulat thr rncansulatin OOP principle, to allow other class to access these variables,
Explanation / Answer
Question 7a
Answer: String
Question 7b
Answer: int height = Integer.parseInt(sHeight);
Question 7c
Answer: double cost = Double.parseDouble(sCost);
Question 8 1)
Answer: mutator method.
Question 8 2)
Answer: accessor method.