Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
Java example - for loop and conditionals from course exercise
Most of our training modules have exercises at the end (sometimes in the middle too) to help delegates checkpoint their understanding, and to give the tutor feedback as to how they're doing, and what coding techniques and habits they're bringing from other languages. With the exercises, there's rarely a "right" way of doing it, and over the years I've added a number of sample answers to our web site - to the extent that there are commented samples for most of the exercises on the courses. But just occasionally we find one that isn't ... and that happened today.
Here's the question:
One hundred Singapore Dollars are worth 56.54 US Dollars.
Write a program to produce a conversion table.
The first column should be a number of US dollars 10, 20, 30 and so on up to 100.
The second column should be the number of Signapore Dollars that it's worth.
You are visiting Singapore and you see a teapot in a shop window at 75 Singapore Dollars.
Extend your previous program, adding a third column on the right of your output that
says either "YOU CAN AFFORD THE TEAPOT" or "YOU DON'T HAVE ENOUGH MONEY FOR THE TEAPOT"
And source of the sample answer - [here]
. (written 2015-02-16)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesJ704 - Java - Loops and Conditional Statements 
A behaviour driven example of writing a Java program - (2014-12-09) 
Learning to program - Loop statements such as while - (2014-11-22) 
Learning to Program - the conditional statement (if) - (2014-11-21) 
Does a for loop evaluate its end condition once, or on every iteration? - (2011-08-18) 
How a for loop works Java, Perl and other languages - (2011-03-12) 
Setting up individual variables, and arrays, in Java - some commented examples - (2010-11-09) 
for and foreach in Java - (2010-04-22) 
Saying NOT in Perl, PHP, Python, Lua ... - (2008-07-04) 
Ruby, C, Java and more - getting out of loops - (2008-03-19) 
for loop - how it works (Perl, PHP, Java, C, etc) - (2007-06-06) 
Wimbledon Neck - (2005-06-20)
Some other Articles
A Java servlet that is also a stand alone program. And a server that is also a web client.The spirit of Java - delegating to classesWind Turbines - beauty or menace?Using the lead - passing arrays and other collections in JavaJava example - for loop and conditionals from course exerciseFileMaker Day to Unix Time conversionA Welsh valley - what the transport looks like in 2015Looking Forward - TransWilts Community Rail Partnership and TransWilts CICCampus - about the logos / way marks you have been choosing fromObjects - from physical to virtual or abstract - Java
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page
This is a page archived from The Horse's Mouth at
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).