Question 13 (1 point) Given the following pseudocode Class Coordinate Private Re
ID: 3734223 • Letter: Q
Question
Question 13 (1 point) Given the following pseudocode Class Coordinate Private Real x Private Real y Public Module set x (Real value) alue End Module Public Module set y (Real value) set yv alue End Module Public Function ge tx() Return x End Module Public Function ge t_yo) Returny End Module Public Module add ( Coordinate c) x + c.get_x( y + c.get y) set x= End Module End Class Module main() Declare Coordinate c1 = New Coordinate() Declare Coordinate c2New Coordinate() Call cl.set x(1.0 Call c1.set y(2.0) Call c2.set x (3.0) Call c2.set y(4.0) Display cl.get_x , cl.get_y(), c2.get_x(), 2.get_y Call cl.add (c2) Display cl.get_x , cl.get_y(), c2.get_x(), 2.get_y End Module What will be the output when the main) module is called? Separate each answer with a single space.Explanation / Answer
13)
In main() c1 and c2 objects are created and c1.set_x(1.0) and c1.set_y(2.0) will store 1.0 in_x and 2.0 in _y
and c2.set_x(3.0),c2.set_y(4.0) will store 3.0 in _x and 4.0 in _y
c1.add(c2) will modify _x and _y values belonging to c1 so _x=1.0+3.0=4.0 and _y=2.0+4.0=6.0
Therefore the output is
1.0,2.0,3.0,4,0 4.0,6.0,3.0,4.0
14)
Here for parent class "Animal" array of 3 objects are created say pets
so pets[0].setName("Dorothy") will call Dog() constructor to set name="Dorothy"
pets[1].setName("Ginger") will call Cat() constructor to set name="Ginger"
pets[2].setName("Ralph") will call Bird() constructor to set name="Ralph"
After running loop three times the output is
Dorothy woofs.
Ginger meows.
Ralph chirps.
12)
The output is fibonacci series stored in the form of array i.e, vals
1 1 2 3 5 8 13 21
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.