Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) What should be entered on LINE 9? 2) What should be entered on LINE 20? 3) As

ID: 3627286 • Letter: 1

Question

1)      What should be entered on LINE 9?

2)      What should be entered on LINE 20?

3)      Assuming that all corrections have been made, what will be displayed after LINE 47 is executed?

4)      Assuming all corrections have been made, what will be displayed after LINE 40 is executed?

--------------------------------------------------------------------------------------------------------------------------

1)      public class Sphere

2)      {

3)      private double radius;

4)      private double x;

5)      private double y;

6)      private double z;

7)      public void setRadius(double rad)

8)      {

9)     

10)   }

11)   public void setX(double x_coord)

12)   {

13)   x = x_coord;

14)   }

15)   public void setY(double y_coord)

16)   {

17)   y = y_cord;

18)   }

19)   public void setZ(double z_coord)

20)   {

21)   Z = z_coord;

22)   }

23)   public double getRadius ( )

24)   {

25)   return radius;

26)   }

27)   public double getX ( )

28)   {

29)   return x;

30)   }

31)   Public double getY( )

32)   {

33)   Return y;

34)   }

35)   Public getZ ( )

36)   {

37)   Return z;

38)   }

39)   }

40)  

41)   public class SphereDemo

42)   {

43)   public static void main(String [ ] args)

44)   {

45)   Sphere sphere = new Sphere ( );

46)   Double r = sphere.getRadius ( );

47)   Double x = sphere.getX( );

48)   Double y = sphere.getY ( );

49)   Z = sphere.getZ ( );

50)   System.out.println ("r = " + r + " x = " + x + "y = " + y + “z = “ + z);

51)   sphere.setRadius(15.3);

52)   sphere.setX(5.0);

53)   sphere.setY(8.3);

54)   sphere.setZ(6.9)

55)   r = getRadius ( );

56)   x = getX ( );

57)   y = getY ( );

58)   z = getZ ( );

59)   System.out.println("r = " + r + " x = " + x + " y = " + y + “z = “ + z);

60)   }

61)   }

1)      What should be entered on LINE 9?

2)      What should be return type?

---------------------------------------------------------------------------------------------------------------------------

1)      public class Sphere

2)      {

3)      private double radius;

4)      private double x;

5)      private double y;

6)      private double z;

7)      public void setRadius(double rad)

8)      {

9)     

10)   }

11)   public void setX(double x_coord)

12)   {

13)   x = x_coord;

14)   }

15)   public void setY(double y_coord)

16)   {

17)   y = y_cord;

18)   }

19)   public void setZ(double z_coord)

20)   {

21)   Z = z_coord;

22)   }

23)   public double getRadius ( )

24)   {

25)   return radius;

26)   }

27)   public double getX ( )

28)   {

29)   return x;

30)   }

31)   Public double getY( )

32)   {

33)   Return y;

34)   }

35)   Public getZ ( )

36)   {

37)   Return z;

38)   }

39)   }

40)  

41)   public class SphereDemo

42)   {

43)   public static void main(String [ ] args)

44)   {

45)   Sphere sphere = new Sphere ( );

46)   Double r = sphere.getRadius ( );

47)   Double x = sphere.getX( );

48)   Double y = sphere.getY ( );

49)   Z = sphere.getZ ( );

50)   System.out.println ("r = " + r + " x = " + x + "y = " + y + “z = “ + z);

51)   sphere.setRadius(15.3);

52)   sphere.setX(5.0);

53)   sphere.setY(8.3);

54)   sphere.setZ(6.9)

55)   r = getRadius ( );

56)   x = getX ( );

57)   y = getY ( );

58)   z = getZ ( );

59)   System.out.println("r = " + r + " x = " + x + " y = " + y + “z = “ + z);

60)   }

61)   }

1)      In LINE 45 the word “new” _______.

2)      LINEs 55-58 each has the same error. What is the error?

3)      On LINE 49, what should the data type of z be?

Please be very accurate

Thank you so much

Explanation / Answer

1)      What should be entered on LINE 9?

2)      What should be entered on LINE 20?

return radius

3)      Assuming that all corrections have been made, what will be displayed after LINE 47 is executed?

just printing the values..

4)      Assuming all corrections have been made, what will be displayed after LINE 40 is executed?

1)      What should be entered on LINE 9?

2)      What should be return type?

1)      In LINE 45 the word “new” _______.

2)      LINEs 55-58 each has the same error. What is the error?

     to access function we have to use through object name.

3)      On LINE 49, what should the data type of z be?