MyNumber
Lisez d'abord l'énoncé, et essayez de résoudre l'exercice. Ensuite vous pouvez utiliser la boîte de sélection afin d'afficher le code correspondant.
Enoncé
La classe MyNumber nous est donnée :
Code Java (MyNumber) (20 lignes)
public class MyNumber { "nil","one","two","three","four","five","six","seven","eight","nine","ten", "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen", "eighteen","nineteen","twenty" }; "twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety" }; private int number; public MyNumber(int number){ this.number=number; } //Your code here// } }
Le but de cette classe est de retourner une chaîne de caractères qui représente la forme anglaise d'un nombre.
- Pour simplifier le code, nous pouvons restreindre l'étendue des valeurs aux entiers entre 0 compris et 999 compris.
- Attention au mot "and"...
Exemples :
twelve, fiftynine, two hundred and twentysix, three hundred
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 15/05/2005, last modified the 08/08/2019
Source of the printed document:https://www.gaudry.be/en/javaex-rf-MyNumber.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.