Skip to content

Commit

Permalink
Homework1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Hnoianko committed Nov 19, 2017
0 parents commit c5d6ab4
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Homework1.1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Homework1.1.iml
.idea/
out/
61 changes: 61 additions & 0 deletions Homework1.1/src/com/gmail/gnoianko/Cat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.gmail.gnoianko;

public class Cat {
private String name;
private int age;
private double weight;
private String coatColor;

public Cat(String name, int age, double weight, String coatColor) {
this.name = name;
this.age = age;
this.weight = weight;
this.coatColor = coatColor;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public double getWeight() {
return weight;
}

public void setWeight(double weight) {
this.weight = weight;
}

public String getCoatColor() {
return coatColor;
}

public void setCoatColor(String coatColor) {
this.coatColor = coatColor;
}

public void voice() {
System.out.println("Hello world ;)");
}

@Override
public String toString() {
return "Cat{" +
"name='" + name + '\'' +
", age=" + age +
", weight=" + weight +
", coatColor='" + coatColor + '\'' +
'}';
}
}
11 changes: 11 additions & 0 deletions Homework1.1/src/com/gmail/gnoianko/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.gmail.gnoianko;

public class Main {
public static void main(String[] args) {
Cat catOne = new Cat("Bobik", 4, 4.5, "Black");
catOne.voice();
System.out.println(catOne);
catOne.setCoatColor("White");
System.out.println(catOne);
}
}

0 comments on commit c5d6ab4

Please sign in to comment.