Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package practicum4;
- /**
- *
- * @author niels
- */
- public class Veelhoek {
- private Punt[] veelhoek;
- Veelhoek() {
- veelhoek = new Punt[3]; //maak ruimte voor 3 punten
- for(int i=0; i<veelhoek.length;i++) { //zet alle 3 de punten naar (0,0)
- veelhoek[i] = new Punt();
- }
- }
- public void print() {
- for(int i=0; i<veelhoek.length;i++) {
- veelhoek[i].print();
- }
- }
- public void dimensie(int N) { //reset veelhoek naar het aantal punten in N
- if(N < 3) {
- System.out.println("Opgegeven Dimensie is niet >= 3 ");
- return;
- }
- veelhoek = new Punt[N]; //maak ruimte voor N punten
- for(int i=0; i<veelhoek.length;i++) { //zet alle 3 de punten naar (0,0)
- veelhoek[i] = new Punt(0, 0);
- }
- }
- public void setPunt(int N, Punt p) {
- veelhoek[N-1] = p;
- }
- public void verschuif(float xass, float yass) {
- for(int i=0; i<veelhoek.length;i++) {
- veelhoek[i].verschuif(xass, yass);
- }
- }
- }
Add Comment
Please, Sign In to add comment