forked from Yandex-Practicum/Java-Module-Project-YP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRubles.java
More file actions
26 lines (23 loc) · 701 Bytes
/
Rubles.java
File metadata and controls
26 lines (23 loc) · 701 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
public class Rubles {
public static String writeRouble() {
String rouble;
double payPerFriend = 0;
int intPayPerFriend = (int) payPerFriend;
if (intPayPerFriend % 100 >= 10 && intPayPerFriend % 100 <= 20) {
rouble = " рублей";
} else {
switch (intPayPerFriend % 10) {
case 1:
rouble = " рубль";
break;
case 2:
case 3:
case 4:
rouble = " рубля";
break;
default:
rouble = " рублей";
}
}
return rouble; }
}