Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Piste{
- private int x;
- private int y;
- public Piste(int i, int j){
- if(i>100){i=100;}
- if(i<0){i=0;}
- if(j>100){j=100;}
- if(j<0){j=0;}
- x=i;
- y=j;
- }
- public String toString(){
- String coordinates=null;
- coordinates=("("+x+","+y+")");
- return coordinates;
- }
- public void siirrä(int k,int l){
- x=x+k;
- if(x>100)
- {
- x=100;
- }
- if(x<0)
- {
- x=0;
- }
- y=y+l;
- if(y>100){
- y=100;
- }
- if(y<0){
- y=0;
- }
- }
Add Comment
Please, Sign In to add comment