Skip to content

Instantly share code, notes, and snippets.

@josinSbazin
Created June 14, 2016 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josinSbazin/dca07ea8a823f3e0ae0aa354f7cd3bc4 to your computer and use it in GitHub Desktop.
Save josinSbazin/dca07ea8a823f3e0ae0aa354f7cd3bc4 to your computer and use it in GitHub Desktop.
level14.lesson06.home01
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.javarush.test.level14.lesson06.home01;
import com.javarush.test.level14.lesson06.home01.Hen;
public class BelarusianHen extends Hen {
public BelarusianHen() {
}
public int getCountOfEggsPerMonth() {
return 123;
}
public String getDescription() {
return super.getDescription() + " Моя страна - " + "Belarus" + ". Я несу " + this.getCountOfEggsPerMonth() + " яиц в месяц.";
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.javarush.test.level14.lesson06.home01;
public interface Country {
String UKRAINE = "Ukraine";
String RUSSIA = "Russia";
String MOLDOVA = "Moldova";
String BELARUS = "Belarus";
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.javarush.test.level14.lesson06.home01;
public abstract class Hen {
public Hen() {
}
abstract int getCountOfEggsPerMonth();
public String getDescription() {
return "Я курица.";
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.javarush.test.level14.lesson06.home01;
import com.javarush.test.level14.lesson06.home01.Hen;
public class MoldovanHen extends Hen {
public MoldovanHen() {
}
public int getCountOfEggsPerMonth() {
return 64;
}
public String getDescription() {
return super.getDescription() + " Моя страна - " + "Moldova" + ". Я несу " + this.getCountOfEggsPerMonth() + " яиц в месяц.";
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.javarush.test.level14.lesson06.home01;
import com.javarush.test.level14.lesson06.home01.Hen;
public class RussianHen extends Hen {
public RussianHen() {
}
public int getCountOfEggsPerMonth() {
return 132;
}
public String getDescription() {
return super.getDescription() + " Моя страна - " + "Russia" + ". Я несу " + this.getCountOfEggsPerMonth() + " яиц в месяц.";
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.javarush.test.level14.lesson06.home01;
import com.javarush.test.level14.lesson06.home01.BelarusianHen;
import com.javarush.test.level14.lesson06.home01.Hen;
import com.javarush.test.level14.lesson06.home01.MoldovanHen;
import com.javarush.test.level14.lesson06.home01.RussianHen;
import com.javarush.test.level14.lesson06.home01.UkrainianHen;
import java.util.HashMap;
public class Solution {
public Solution() {
}
public static void main(String[] args) {
Hen hen = Solution.HenFactory.getHen("Belarus");
hen.getCountOfEggsPerMonth();
System.out.println(hen.getDescription());
}
static class HenFactory {
HenFactory() {
}
static Hen getHen(String country) {
HashMap hans = new HashMap();
hans.put("Russia", new RussianHen());
hans.put("Belarus", new BelarusianHen());
hans.put("Moldova", new MoldovanHen());
hans.put("Ukraine", new UkrainianHen());
Hen hen = (Hen)hans.get(country);
return hen;
}
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.javarush.test.level14.lesson06.home01;
import com.javarush.test.level14.lesson06.home01.Hen;
public class UkrainianHen extends Hen {
public UkrainianHen() {
}
public int getCountOfEggsPerMonth() {
return 45;
}
public String getDescription() {
return super.getDescription() + " Моя страна - " + "Ukraine" + ". Я несу " + this.getCountOfEggsPerMonth() + " яиц в месяц.";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment