ALICE 2 introduction to computer 1. Create an ant 2. Let the ant march forward w
ID: 3764432 • Letter: A
Question
ALICE 2 introduction to computer 1. Create an ant 2. Let the ant march forward while singing a song 3. The song needs to repeat 10 times, with similar content while some keywords are changing each time 4. You need to create two arrays that contain 10 keywords each. 5. These two arrays will look like the following: a. keywordArray = “suck his thumb, tie his shoe, climb a tree, shut the door, take a dive, pick up sticks, pray to heaven, shut the gate, check the time, say THE END.” b. numArray= “one, two, three, four, five, six, seven, eight, night, ten” 6. The song will be as follows. Note that all bold keywords need to be replaced with the two arrays in every repeat. The ants go marching one-by-one Hurrah! Hurrah! The ants go marching one-by-one Hurrah! Hurrah! The ants go marching one-by-one the little one stopped to suck his thumb,
Explanation / Answer
public class Ant {
public static void main(String[] args) {
String[] activites = {"suck his thumb,", "tie his shoe,", "climb a tree,", "shut the door,", "take a dive,", "pick up sticks,", "pray to heaven,", "shut the gate,", "check the time,", "say THE END."};
String[] numbers = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"};
String line1 = "The ants go marching one-by-one Hurrah! Hurrah!";
for (int i = 0; i < 10; i++) {
System.out.println(line1);
System.out.println(line1);
System.out.println("The ants go marching one-by-one the little " + numbers[i] + " stopped to " + activites[i]);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.