Lists

icon picker
memorise a list

un, deux, trois ...

Les chiffres: how to spell numbers in French


Using the names of numbers is a useful at an early stage in learning another language.

requirement

Store the spelling of the numbers 0 to 5 in French. An array will be needed to store the list of six French words. Display each number digit along with the French spelling. The user can then read and try to memorise each number spelling. Allow the user to choose any number by typing in the digit and the program should display the spelling for that word. The user can try to predict the spelling and then ask the program to show the correct spelling.
Here is a if you would like to hear how to say these words
sample output
0 - zéro
1 - un
2 - deux
3 - trois
4 - quatre
5 - cinq
Please enter a digit (0-5) to spell: 2
2 - deux

design

store
a list of number names in French
input
a number to spell
output
the full list on number names in French, the number name for the number chosen by the user
process
no calculations required
algorithm
1. store the names of the numbers 0 to 5 in French
2. display the first stored number 0
3. display the second stored number 1
4. display the third stored number 2
5. display the fourth stored number 3
6. display the fifth stored number 4
7. display the sixth stored number 5
8. ask the user to enter a number to spell
9. display the number name for the number entered by the user

code features

store a list using an array

String[] numberNames = {"zéro", "un", "deux", "trois", "quatre", "cinq"};
Declare a String array called numberNames and initialise it to store the six text values in the order shown
Notice the [ ] brackets after the term String, this show that it is an array and not an ordinary single value string.
Notice the { } brackets surrounding the list of text values
Notice the " " for each value and the commas separating each value
Notice that there are six values, 0-5
Notice that the the digit 0 is in first position and 5 is in sixth position

display a value from an array

System.out.println( 0 + " - " + numberNames[0]);
numberNames[0] identifies the array and the position of the element to be used, 0 is the position of the first element
System.out.println( spellDigit + " - " + numberNames[spellDigit]);
numberNames[spellDigit] identifies the array and the position of the element to be used, spellDigit is a variable that should have been set to any value 0-5

program code

Loading…

PRIMM

predict

* what word will be displayed when the digit 1 is entered
* what value should be entered to display "cinq"

investigate

what happens if you enter the value 6
what happens when you enter the value -1
what happens when you enter the value 3.5 or 1.0

modify

The next set of French words for the numbers 6-10 are:
six, sept, huit, neuf, dix
Can you edit your code to include the new words at the end of the existing list. Then get the program to display all the numbers up to 10. Can you anticipate what position the word "dix" will be in?

make

What is the most recent list you have had to memorise?
Add some code to this program to store your list and display all the values in your list?

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.