Disc.java 459 B

12345678910111213141516171819202122232425262728
  1. /**
  2. Represents a Disc with a certain size.
  3. @author Tobi
  4. */
  5. public class Disc {
  6. private int size;
  7. /**
  8. Creates a {@code Disc} with a given size.
  9. Size has to be a positive number, greater 0.
  10. @param size the size of the disc.
  11. */
  12. public Disc(int size) {
  13. if (size <= 0) {
  14. throw new IllegalArgumentException("Invalid Disc-Size!");
  15. }
  16. this.size = size;
  17. }
  18. /**
  19. Returns the size of the Disc.
  20. */
  21. public int getSize() {
  22. return size;
  23. }
  24. }