mirror of
https://github.com/robindhole/fundamentals.git
synced 2025-03-15 22:10:22 +00:00
Adds bird v0 branch.
This commit is contained in:
parent
d24d8dc670
commit
c90260eac1
24
oop/code/oop/src/main/java/com/scaler/lld/bird/Bird.java
Normal file
24
oop/code/oop/src/main/java/com/scaler/lld/bird/Bird.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.scaler.lld.bird;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class Bird {
|
||||
private Integer weight;
|
||||
private String colour;
|
||||
private String size;
|
||||
private String beakType;
|
||||
private BirdType type;
|
||||
|
||||
public void fly() {
|
||||
if (type == BirdType.Eagle) {
|
||||
System.out.println("Eagle is flying");
|
||||
} else if (type == BirdType.Penguin) {
|
||||
System.out.println("Penguin is swimming");
|
||||
} else if (type == BirdType.Parrot) {
|
||||
System.out.println("Parrot is flying");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.scaler.lld.bird;
|
||||
|
||||
public enum BirdType {
|
||||
Eagle, Penguin, Parrot
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user