Draw different types of angles

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 360 (not including 0 and 360) and displays a message saying if the angle is an acute, right, obtuse, straight or a reflex angle. It then draws two lines of length 100 steps, starting from x:0, y:0, with the given angle between them.

Testing examples:

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

Input Output
0 The angle you entered is an acute angle.
45 The angle you entered is an acute angle.
90 The angle you entered is a right angle.
110 The angle you entered is an obtuse angle.
180 The angle you entered is a straight angle.
240 The angle you entered is a reflex angle.

Languages

Scratch

What it should look like

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

Recommended blocks for solution 1
whenclicked
clearsetpensizeto3pendownpenup
gotox:0y:0pointindirection90move100stepsturn180-angledegreesmove100steps
sayThe angle you entered is an acute angle.for3secssayThe angle you entered is a right angle.for3secssayThe angle you entered is an obtuse angle.for3secssayThe angle you entered is a straight angle.for3secssayThe angle you entered is a reflex angle.for3secs
askEnter an angle between 0 and 360 (not including 0 and 360):andwaitsetangletoanswer
ifangle>0andangle<90thenifangle=90thenifangle>90andangle<180thenifangle=180thenifangle>180then
Recommended blocks for solution 2
whenclicked
clearsetpensizeto3pendownpenup
gotox:0y:0pointindirection90move100stepsturn180-angledegreesmove100steps
askEnter an angle between 0 and 360 (not including 0 and 360):andwaitsetangletoanswer
sayThe angle you entered is an acute angle.for3secssayThe angle you entered is a right angle.for3secssayThe angle you entered is an obtuse angle.for3secssayThe angle you entered is a straight angle.for3secssayThe angle you entered is a reflex angle.for3secs
ifangle<90thenelseifangle<180thenelseifangle=90thenelseifangle=180thenelse
Hints

Description of different angles:

  • An acute angle is an angle between 0 and 90 degrees (not including 90).
  • A right angle is a 90 degrees angle.
  • Obtuse angle is an angle between 90 and 180 degree (not including 90 and 180).
  • A straight angle is a 180 degrees angle.
  • A reflex angle is an angle greater than 180 degrees.

There are different ways to program checking the range using the if()/else blocks. Below are hints for two different ways you may program this:

  • Use a series of if() blocks sequentially checking for the ranges in each if() block. If you need to check a range between two values you can use the and operator in the condition for your if() block (the AND operator reports true if both conditions are true).

  • Use nested if() or if()/else blocks, which are if()/else blocks inside another set of if()/else blocks (i.e. a nested conditional statement is a conditional statement where the if() and/or else contains another conditional statement). For example:

    ifangle<180thenifangle<90thenacuteangle

Show Scratch solution