diff --git a/src/main/java/ru/ifmo/cet/javabasics/BottleSong.java b/src/main/java/ru/ifmo/cet/javabasics/BottleSong.java index 541b26e..eb368fb 100644 --- a/src/main/java/ru/ifmo/cet/javabasics/BottleSong.java +++ b/src/main/java/ru/ifmo/cet/javabasics/BottleSong.java @@ -1,43 +1,75 @@ package ru.ifmo.cet.javabasics; -/** - * Нужно реализовать констурктор и метод, возвращающий слова песни про бутылки на стене. - *
- * Слова следующие: - *
- * 99 bottles of beer on the wall, 99 bottles of beer - * Take one down, pass it around, 98 bottles of beer - * 98 bottles of beer on the wall, 98 bottles of beer - * Take one down, pass it around, 97 bottles of beer - * 97 bottles of beer on the wall, 97 bottles of beer - * Take one down, pass it around, 96 bottles of beer - * 96 bottles of beer on the wall, 96 bottles of beer - * Take one down, pass it around, 95 bottles of beer - * 95 bottles of beer on the wall, 95 bottles of beer - * ... - *
- * 3 bottles of beer on the wall, 3 bottles of beer - * Take one down, pass it around, 2 bottles of beer - * 2 bottles of beer on the wall, 2 bottles of beer - * Take one down, pass it around, 1 bottles of beer - * 1 bottle of beer on the wall, 1 bottle of beer - * Take one down, pass it around, no more bottles of beer on the wall - * No more bottles of beer on the wall, no more bottles of beer - * Go to the store and buy some more, 99 bottles of beer on the wall - *
- * Дело усложняется тем, что текст песни переменный:
- * За раз может быть взято несколько бутылок.
- * Значение передается в качестве параметра конструктора
- * Нужно ограничить возможность взятия бутылок натуральным число не более 99 бутылок за раз.
- */
-public class BottleSong {
+import java.util.HashMap;
+import java.util.Map;
+public class BottleSong {
+ private int bottlesTakenAtOnce;
public BottleSong(int bottleTakenAtOnce) {
- //TODO
+ this.bottlesTakenAtOnce = bottleTakenAtOnce;
}
public String getBottleSongLyrics() {
- //TODO
- throw new UnsupportedOperationException();
+ int bottles = 99;
+ String SUNum = "";
+ String BottleSongLyrics = "";
+ String BottlesBottle = "bottles";
+
+ Map