Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import turtles.*;
- public class Pythagorean extends TurtleProgram {
- private static final long serialVersionUID = 1L;
- public void run() {
- this.setSize(800, 600);
- Turtle marisa = new Turtle (400, 300);
- int lega = readInt("leg a");
- int legb = readInt("leg b");
- double angle = (45 * (lega / legb));
- int variable =(lega * lega) + (legb * legb);
- double hypot = (double) Math.sqrt(variable);
- marisa.forward(lega);
- marisa.left(90);
- marisa.forward(legb);
- marisa.left(180);
- marisa.right(angle);
- marisa.forward(hypot);
- marisa.hide();
- System.out.println("lega: " + lega + "\nlegb: " + legb + "\nhypot: " + hypot + "\nvariable: " + variable + "\nangle: " + angle);
- }
- }
Add Comment
Please, Sign In to add comment