-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeerSong.java
More file actions
42 lines (36 loc) · 1.1 KB
/
BeerSong.java
File metadata and controls
42 lines (36 loc) · 1.1 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
37
38
39
40
41
42
/**
*
*/
/**
* @author DELL
* Project Name: Java_learn
* Class Name: BeerSong
* date: 2019年8月19日{time}
*/
public class BeerSong {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int beerNum = 99;
String word = "bottles";
while (beerNum > 0) {
if (beerNum == 1) {
word = "bottle";
}
System.out.println(beerNum + " " + word + " of beer on the wall");
System.out.println(beerNum + " " + word + " of beer.");
System.out.println("Take one down.");
System.out.println("Pass it around.");
beerNum = beerNum - 1;
if (beerNum > 0) {
System.out.println(beerNum + " " + word + " of beer on the wall");
} else {
System.out.println("No more bottles of beer on the wall");
}
System.out.println("*****************************");
System.out.println("*****************************");
}
}
}