Draw different types of triangles

Challenge Level: Growing experience

Learning outcomes

Students will be able to:

Requirement:

Write a program that asks the user to enter an angle between 0 and 180 (not including 0 and 180), draws a triangle with two equal sides of length 100 steps (an isosceles triangle), starting from x:0, y:0, with the given angle between them. It then displays a message saying if the triangle drawn is an acute, right or an obtuse triangle.

Testing examples:

Your program should display the outputs shown in this table for the given inputs provided:

Input Output
45 This is an acute triangle.
90 This is a right triangle.
120 This is an obtuse triangle.

Languages

Scratch

What it should look like

Click on the green flag to see the expected output of your program.

Recommended blocks
when green flag clicked
clear

set pen size to (3)

pen down

pen up
set [angle v] to (answer)

ask [Enter an angle between 0 and 180 (not including 0 and 180):] and wait
go to x: (0) y: (0)

go to x: (0) y: (0)

point in direction (90 v)

move (100) steps

move (100) steps

turn ccw ((180) - (angle)) degrees
say [This is an acute triangle.] for (2) secs

say [This is a right triangle.] for (2) secs

say [This is an obtuse triangle.] for (2) secs
if <(angle) < [90]> then
end

if <(angle) = [90]> then
end

if <(angle) > [90]> then
end
Hints
  • A triangle with two sides equal is called an isosceles triangle.
  • In this challenge, the third side of the triangle can be drawn by connecting the third vertex (location of the sprite after drawing the angle in challenge 6.1) to the first vertex (x:0 y:0).
  • An acute triangle is a triangle which all angles are less than 90 degrees.
  • A right triangle is a triangle which has a right angle (90 degrees).
  • An obtuse triangle: has an angle more than 90 degrees.

Show Scratch solution

Extra Challenge

Extra challenge #1: Edit your program so it would display a message if the angle entered by the user is not between 0 and 180 (i.e. less than or equal to 0 or greater than or equal to 180).