import java.util.ArrayList;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
ArrayList<Animal> animals=new ArrayList<>();
animals.ensureCapacity(10);
Scanner scanner=new Scanner(System.in);
System.out.println("age: weight: name: breed:");
for(int i=0;i<5;i++)
{
Animal animal=new Animal(scanner.nextInt(),scanner.nextDouble(),scanner.nextLine(),scanner.nextLine());
animals.add(animal);
// animals.add(new Animal(scanner.nextInt(),scanner.nextDouble(),scanner.nextLine(),scanner.nextLine()));
}
/* animals.add(new Animal(12,22,"Hound","Rufus"));
animals.add(new Animal(11,56,"Andrew","Carrot"));
animals.add(new Animal(43,44,"Antonio","Banderas"));
*/
for(Animal e:animals)
{
System.out.println(e.toString());
}
}
}
package codeWars;
public class Animal
{
private int age;
private double weight;
private String name;
private String breed;
public Animal(int age,double weight,String name,String breed)
{
this.age=age;
this.weight=weight;
this.name=name;
this.breed=breed;
}
public String getBreed()
{
return breed;
}
public Animal()
{
}
public int getAge() {
return age;
}
public double getWeight() {
return weight;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String toString()
{
return getClass().getName()+" age: "+age+" weight: "+weight+" name "+ name+ " breed "+breed;
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}