Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Finch myFinch = new Finch();
  2. public void FinchGround() {
  3. if (myFinch.isFinchLevel()) {
  4.  
  5. }
  6. else {
  7. System.out.println("Error");
  8. FinchGround();
  9. }
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. Finch myFinch = new Finch();
  18.  
  19. public void Foward(double dblxl) {
  20. int Ftime = (int) dblxl * 100;
  21. myFinch.setWheelVelocities(100, 100, Ftime);
  22.  
  23.  
  24. }
  25.  
  26. public void turnRight(int degrees) {
  27. double Righttime = degrees * 11.2;
  28. int Rtime = (int) Righttime;
  29. myFinch.setWheelVelocities(132, 0, Rtime);
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. private double xlength;
  39. private double ylength;
  40. MovingFinch move = new MovingFinch();
  41. FinchTemplateFile ss = new FinchTemplateFile();
  42. static Scanner myObj = new Scanner(System.in);
  43.  
  44. public void checkSquare(double x, double y){
  45.  
  46. xlength = x;
  47. ylength = y;
  48.  
  49. if ((xlength < 85) && (ylength < 85) && (xlength > 15) && (ylength > 15)) {
  50.  
  51. drawSquare(xlength, ylength);
  52.  
  53.  
  54. }
  55. else {
  56. System.out.println("error");
  57. gettingInputsquare();
  58. }
  59.  
  60. }
  61.  
  62. public void drawSquare(double dblxl, double dblyl) {
  63.  
  64. xlength = dblxl;
  65. ylength = dblyl;
  66. int i = 0;
  67. while (i < 5) {
  68. move.Foward(dblxl);
  69. move.turnRight(90);
  70. i++;
  71. }
  72.  
  73.  
  74. }
  75. public void gettingInputsquare() {
  76. System.out.println("Enter a Square length 1: ");
  77. double xl = myObj.nextInt();
  78. System.out.println("Enter a Square length 2: ");
  79. double yl = myObj.nextInt();
  80. xlength = xl;
  81. ylength = yl;
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement