Advertisement
khang_le

Cube2BestPractice

Jun 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. public class Cube
  2. {
  3. private int Side;
  4.  
  5. //This cube needs your help.
  6. //Define a constructor which takes one integer and assignes its value to 'Side'
  7. public Cube(int s)
  8. {
  9. SetSide(s);
  10. }
  11.  
  12. public Cube()
  13. : this(0)
  14. {
  15.  
  16. }
  17. public int GetSide()
  18. {
  19. return Side;
  20. }
  21.  
  22. public void SetSide(int s)
  23. {
  24. Side = System.Math.Abs(s);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement