-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSong2.java
More file actions
128 lines (82 loc) · 2.87 KB
/
Song2.java
File metadata and controls
128 lines (82 loc) · 2.87 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// author : shamar Gordon
// duedate : 02/06/2023
// purpose : to create a song using methods
//Assumptions : #2
//section :4
package Assignments; // package name
public class Song2 {
// main method
public static void main (String[] avg) {
cat(); // call the cat method
hen(); // call the hen method
duck(); // call the duck method
goose(); // call the goose method
sheep(); // call the sheep method
pig(); // call the pig method
}
// verses method
private static void verses1() {
System.out.print("Cat goes fiddle-i-fee.");
}
// verses2 method
private static void verses2() {
System.out.println("Hen goes chimmy-chuck, chimmy-chuck");
verses1();
} // verses3 method
public static void verses3 () {
System.out.println("Duck goes quack, quack,");
verses2();
}
// verses4 method
public static void verses4 () {
System.out.println("Goose goes hissy, hissy");
verses3();
}
// verses5 method
public static void verses5() {
System.out.println("Sheep goes baa, baa,");
verses4();
}
// cat method
public static void cat() {
System.out.println("\nBought me a cat and the cat pleased me, \n" +
"I fed my cat under yonder tree");
verses1();
System.out.println();
}
// hen method
public static void hen() {
System.out.println("\nBought me a hen and the hen pleased me,\n" +
"I fed my hen under yonder tree ");
verses2();
System.out.println(); // print a blank line
}
// duck method
public static void duck() {
System.out.println("\nBought me a duck and the duck pleased me,\n" +
"I fed my duck under yonder tree "); // print the first line of the song
verses3();
System.out.println();
}
// goose method
public static void goose() {
System.out.println("\nBought me a goose and the goose pleased me,\n" +
"I fed my goose under yonder tree ");
verses4();
System.out.println(); // print a blank line
}
// sheep method
public static void sheep() {
System.out.println("\nBought me a sheep and the sheep pleased me,\n" +
"I fed my sheep under yonder tree ");
verses5();
System.out.println(); // print a blank line
}
// pig method
public static void pig() {
System.out.println("\nBought me a pig and the pig pleased me,\n" +
"I fed my pig under yonder tree \n" + "Pig goes oink, oink,");
verses5(); // call the verses5 method
System.out.println(); // print a blank line
}
}