<br><br><div class="gmail_quote">On Jan 22, 2008 5:10 PM, Damian Archer <<a href="mailto:imonthejazz@googlemail.com">imonthejazz@googlemail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>So anyone have any good project ideas, perhaps projects that people have undertaken before??</div>
<div> </div></blockquote></div><br>I'm taking a Java class this semester and our first program is a number translator. Here's the assignment:<br><br>
<p class="MsoPlainText"><b style=""><span style="font-size: 12pt; font-family: "Times New Roman";">Below is a sample run:</span></b></p>
<p class="MsoPlainText"><span style=""> </span>Welcome to my
number translator!</p>
<p class="MsoPlainText"><span style=""> </span>Enter amount
[0-999999.99; 0 to exit]: 1234.56<br><span style=""> </span>Translation: one
thousand two hundred thirty-four and 56/100</p>
<p class="MsoPlainText"> </p>
<p class="MsoPlainText"><span style=""> </span>Enter amount
[0-999999.99; 0 to exit]: 17775<br><span style=""> </span>Translation:
seventeen thousand seven hundred seventy-five and 00/100<br> </p>
<p class="MsoPlainText"><span style=""> </span>Enter amount [0-999999.99;
0 to exit]: -45<br><span style=""> </span>Enter amount
[0-999999.99; 0 to exit]: 999999999.99</p>
<p class="MsoPlainText"><span style=""> </span>Enter amount
[0-999999.99; 0 to exit]: 22.95<br><span style=""> </span>Translation:
twenty-two and 95/100<br> </p>
<p class="MsoPlainText"><span style=""> </span>Enter
amount [0-999999.99; 0 to exit]: 0.01<br><span style=""> </span>Translation: zero
and 01/100<br> </p>
<p class="MsoPlainText"><span style=""> </span>Enter
amount [0-999999.99; 0 to exit]: 909909.99<br><span style=""> </span>Translation: nine
hundred nine thousand nine hundred nine and 99/100</p>
<p class="MsoPlainText"> <br><span style=""> </span>Enter amount
[0-999999.99; 0 to exit]: 0<br><span style=""> </span>Bye bye!</p>
<p class="MsoPlainText"><b style=""><u><span style="font-size: 12pt; font-family: "Times New Roman";">Input</span></u></b><span style="font-size: 12pt; font-family: "Times New Roman";"></span></p>
<p class="MsoPlainText"><span style="font-size: 12pt; font-family: "Times New Roman";">You may assume that your input is in
floating point format (no dollar signs or commas or other special characters
other than a single decimal point).<span style=""> </span>But
you will need to check to make sure your input satisfies the specs given above.<span style=""> </span>(Although with exception handling it's not
difficult to validate that you have floating point format.)</span></p>---<br><br>An example routine to translate a number into it's english equivalent was given (again, this is Java):<br><span style=""> </span>static String convertDigitToEnglish(int
d)<span style=""> </span>{<span style=""><br> </span>switch ( d ) <span style=""><br> </span>{<br><p class="MsoPlainText"><span style=""> </span>case 1: <span style=""> </span>return "one";<br>
<span style=""> </span>case 2: <span style=""> </span>return "two";<br><span style=""> </span>case 3: <span style=""> </span>return "three";<br><span style=""> </span>case 4: <span style="">
</span>return "four";<br><span style=""> </span>case 5: <span style=""> </span>return "five";<br><span style=""> </span>case 6: <span style=""> </span>return "six";<br><span style="">
</span>case 7: <span style=""> </span>return "seven";<br><span style=""> </span>case 8: <span style=""> </span>return "eight";<br><span style=""> </span>case 9: <span style="">
</span>return "nine";<br><span style=""> </span>default:<span style=""> </span>return "\nFatal Error!\n"; // should
I abort pgm?<br><span style=""> </span>} // end of
switch<br><span style=""> </span>} // end of convertDigitToEnglish</p>
<br>In Python I'd just use a dictionary. <br><br>HTH,<br><p class="MsoPlainText">jason<br></p><p class="MsoPlainText"><br><span style="font-size: 12pt; font-family: "Times New Roman";"></span></p>
<br>