-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDATE_FASHION.java
More file actions
30 lines (25 loc) · 881 Bytes
/
DATE_FASHION.java
File metadata and controls
30 lines (25 loc) · 881 Bytes
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
/*
You and your date are trying to get a table at a restaurant.
The parameter "you" is the stylishness of your clothes, in the range 0..10, and "date" is the stylishness of your date's clothes.
The result getting the table is encoded as an int value with 0=no, 1=maybe, 2=yes.
If either of you is very stylish, 8 or more, then the result is 2 (yes).
With the exception that if either of you has style of 2 or less, then the result is 0 (no).
Otherwise the result is 1 (maybe).
dateFashion(5, 10) → 2
dateFashion(5, 2) → 0
dateFashion(5, 5) → 1
*/
package school;
public class DATE_FASHION {
public static void main(String[] args){
int answer = dateFashion(5,10);
System.out.println(answer);
}
public static int dateFashion(int you, int date) {
if(you<=2 || date<=2){
return 0;
}else if(you>=8 || date>=8){
return 2;
}return 1;
}
}