Guest User

Untitled

a guest
Jan 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package practicum4;
  6.  
  7. /**
  8. *
  9. * @author niels
  10. */
  11. public class Veelhoek {
  12. private Punt[] veelhoek;
  13.  
  14. Veelhoek() {
  15. veelhoek = new Punt[3]; //maak ruimte voor 3 punten
  16.  
  17. for(int i=0; i<veelhoek.length;i++) { //zet alle 3 de punten naar (0,0)
  18. veelhoek[i] = new Punt();
  19. }
  20. }
  21.  
  22. public void print() {
  23.  
  24. for(int i=0; i<veelhoek.length;i++) {
  25. veelhoek[i].print();
  26. }
  27. }
  28.  
  29. public void dimensie(int N) { //reset veelhoek naar het aantal punten in N
  30.  
  31. if(N < 3) {
  32. System.out.println("Opgegeven Dimensie is niet >= 3 ");
  33. return;
  34. }
  35.  
  36. veelhoek = new Punt[N]; //maak ruimte voor N punten
  37.  
  38. for(int i=0; i<veelhoek.length;i++) { //zet alle 3 de punten naar (0,0)
  39. veelhoek[i] = new Punt(0, 0);
  40. }
  41. }
  42.  
  43. public void setPunt(int N, Punt p) {
  44. veelhoek[N-1] = p;
  45. }
  46.  
  47. public void verschuif(float xass, float yass) {
  48. for(int i=0; i<veelhoek.length;i++) {
  49. veelhoek[i].verschuif(xass, yass);
  50. }
  51. }
  52. }
Add Comment
Please, Sign In to add comment