/* * [SpanishForCheques.java] * * Summary: display a number in Spanish in the style used on cheques. * * Copyright: (c) 1999-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2003-07-14 * 1.1 2009-01-20 incorporate many changes suggested by Erwin Feldhaus * groups now both singular and plural * irregular numbers 11..29 * irregular numbers for 100, 200 .. 900 * break into milliones,billones,trillones,cuatrillones */ package com.mindprod.inwords; /** * display a number in Spanish in the style used on cheques. *

* e.g. * -12345 -> "moins douze mille trois cent quarante-cinq". *

* sources: http://www.bledsoe.k12.tn.us/docs/spcount.html * Barron's Spanish Grammer by Christopher Kendris, PhD. *

* Why is this code written in an unusual way? see inwords.use *

* * @author Roedy Green, Canadian Mind Products * @version 1.1 2009-01-20 incorporate many changes suggested by Erwin Feldhaus * groups now both singular and plural * irregular numbers 11..29 * irregular numbers for 100, 200 .. 900 * break into milliones,billones,trillones,cuatrillones * @ groups now both singular and plural * irregular numbers 11..29 * irregular numbers for 100, 200 .. 900 * break into milliones,billones,trillones,cuatrillones * @since 2003-07-14 */ public final class SpanishForCheques extends SpanishBase implements ToWords { /** * get value for number in range 0..29 * non-monetary version * * @param group 0= units 1=thousands etc. * @param i value 0..29 * * @return word for that value */ String getLowName( int group, int i ) { if ( i == 21 ) { return TWENTY_ONE_COMBINING; } else { return lowName[ i ]; } } /** * get Spanish word for one * * @param group 0= units 1=thousands etc. * * @return Spanish word for one, possibly empty. */ String wordForOne( int group ) { switch ( group ) { case 0: // uno return ONE; case 1: // un mil default: // un millón return ONE_COMBINING; } } /** * test harness to words to spanish. * * @param args not used */ public static void main( String[] args ) { Test.test( new SpanishForCheques(), new DecimalDots() ); } // end main } // end SpanishForCheques