5.4 Sum 3 and 5
Hello everyone! In this course, we will make a challenge as with the "day of the week". Challenges consist in writing a method called "DeMots number". The method has a parameter number which is the integer. The method should display "Zero", "One", "Two",...." Nine" or "Other" If the int parameter number is 0,1,2,..... 9 or other for any other number including negative numbers. You can use the if-else statement or the switch statement, whichever is easier for you. The method "numberDeMots" must be more static. So you are? Go! I hope you have succeeded. Now we will do the correction. So, we’ll create a number of words method. Then, "public static void nombreDeMots" In parentheses int number We write "switch" In parentheses "number". Box 0. Who will display "Zero" break case 1 Who will display "One" break case 2 Who will display "Two" break case 3 Who will display "Three" break case 4 Who will display "Four" break case 5 Who will display "Five" break case 6 Who will display "Six" break case 7 Who will display "Seven" break case 8 Who is going to display "Eight" break case 9 Who is going to display "Nine" break Default Displays "Other" For any other number, for example -1 Or 10 Then a break Now, we will test the method in the "main" method So "numberDeMots" -1 for example "numberDeMots" 0 "Mots number" 1 Up to 9. Then "Mots number" 10 And we execute the code As we can see, we have the results. Listening was all for this video. I’ll see you next time!