/****************************************************************************** * This program computes the lyrics to the song Alouette. * * See: https://en.wikipedia.org/wiki/Alouette_(song) * * Copyright © 2016 Richard Lesh. All rights reserved. *****************************************************************************/ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.pureprogrammer.Utils; public class AlouetteLyrics { static final List PHRASES = Utils.listFromStrings(new String[]{"la tête", "le bec", "les yeux", "le cou", "les ailes", "les pattes", "la queue", "le dos"}); static void printRefrain() { System.out.println("Alouetté, gentille alouetté,"); System.out.println("Alouetté, je te plumerai."); System.out.println(); } static void printVerse(int num) { System.out.println(Utils.join("", "Je te plumerai ", PHRASES.get(num - 1), ".")); System.out.println(Utils.join("", "Je te plumerai ", PHRASES.get(num - 1), ".")); for (int i = num - 1; i >= 0; --i) { System.out.println(Utils.join("", "Et ", PHRASES.get(i), "! Et ", PHRASES.get(i), "!")); } System.out.println("Alouetté! Alouetté!"); System.out.println("A-a-a-ah"); printRefrain(); } public static void main(String[] args) { printRefrain(); for (int i = 1; i <= PHRASES.size(); ++i) { printVerse(i); } } }