Training, Open Source computer languages

PerlPythonMySQLTclRubyC & C++LuaJavaTomcatPHPhttpdLinux

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
A Perl practical on ladder lengths

A Perl practical on ladder lengths

An exercise set during on our Perl Programming course, when we're asking our trainees to write a subroutine. A young gentleman in Verona wishes to take a young lady out one evening, but her parents don't approve of the match. She lives in a castle set on a rocky outcrop, which is 12 metres tall and there's a convenient spot to rest the base of a ladder 5 metres away from the outcrop. Once onto the castle mound, the young gent (shall we call him Romeo?) needs a further ladder to reach the window of his beloved (she's called Juliet), which is a further 4 metres up. He can't get the ladder close, though, as there's a three metre wide rosebed and he has to put the ladder outside that. Write a Perl subroutine to calculate ladder lengths given the height and distance from the wall in each case, and write a piece of test code that makes two calls to this subroutine to work out the ladder lengths needed.

More about this subject
Associated topic - Subroutines in Perl

Next ... random image ... a slide show ... image from list below


© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho