d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Help With Easy Assignment > 42 Fg For Answer Super Easy
Add Reply New Topic New Poll
Member
Posts: 879
Joined: Mar 4 2012
Gold: 12,385.00
Oct 17 2016 11:18am
See if you can create a Web Turtle program that does the following:

If user enters a 3, web turtle draws a triangle; if a 4 is entered, it draws a square; if a 5 is entered, it draws a pentagon. If a number less than 3 or greater than 5 is entered, a message appears on the screen: Enter 3, 4, or 5
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 17 2016 12:09pm
What code do you already have?
Member
Posts: 879
Joined: Mar 4 2012
Gold: 12,385.00
Oct 17 2016 12:16pm
None at all I am working on two other ones I think i have the hang of it at this point should be able to make it pretty easy
Member
Posts: 879
Joined: Mar 4 2012
Gold: 12,385.00
Oct 17 2016 01:29pm
No longer need this was super easy
Member
Posts: 17,090
Joined: Nov 22 2008
Gold: 169.00
Oct 17 2016 01:46pm
LET A ^


IF A = 3
REPEAT 4
DRAW 100
RIGHT 90
NEXT

SHOWTURTLE
END

ENDIF

IF A = 4

REPEAT 3
RIGHT 120
DRAW 100
NEXT

SHOWTURTLE
END

ENDIF

IF A = 5

REPEAT 5
RIGHT 360/5
DRAW 100
NEXT

SHOWTURTLE
END

ENDIF

IF A < 3
PRINT Enter 3, 4, or 5
ENDIF

IF A > 5
PRINT Enter 3, 4, or 5
ENDIF
Member
Posts: 17,090
Joined: Nov 22 2008
Gold: 169.00
Oct 17 2016 01:52pm
Meh, too late, I was on it and havent seen the reply.
(took 5 minutes to learn the syntax, 10 minutes to figure out how to nest if-else statements (gave up), and 10 minutes to draw things correctly)

But I am really curious , why would anyone even bother with this kind of programming where you can`t nest if-else statements?
Even Excel can do it.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll