-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSid.java
More file actions
36 lines (31 loc) · 1.21 KB
/
Sid.java
File metadata and controls
36 lines (31 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// I love you, a little , a lot, passionately ... not at all
// DESCRIPTION:
// Who remembers back to their time in the schoolyard, when girls would take a flower and tear its petals, saying each of the following phrases each time a petal was torn:
// "I love you"
// "a little"
// "a lot"
// "passionately"
// "madly"
// "not at all"
// If there are more than 6 petals, you start over with "I love you" for 7 petals, "a little" for 8 petals and so on.
// When the last petal was torn there were cries of excitement, dreams, surging thoughts and emotions.
// Your goal in this kata is to determine which phrase the girls would say at the last petal for a flower of a given number of petals. The number of petals is always greater than 0.
public class Sid {
public static String howMuchILoveYou(int nb_petals) {
if(nb_petals % 6 == 0){
return "not at all";
}else if(nb_petals % 6 ==1){
return "I love you";
}else if(nb_petals % 6 == 2){
return "a little";
}else if(nb_petals % 6 == 3){
return "a lot";
}else if(nb_petals % 6 == 4){
return "passionately";
}else if(nb_petals % 6 == 5){
return "madly";
}else{
return "";
}
}
}