Skip to content

Commit

Permalink
ApplicationUser and Application classes
Browse files Browse the repository at this point in the history
  • Loading branch information
kacper-cholewinski committed Nov 15, 2024
1 parent ea825eb commit 2448dfa
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kodilla-intro/src/main/java/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public class Application {
public static void main(String[] args) {
ApplicationUser user = new ApplicationUser("Adam", 40.5, 178);
user.checkAgeAndHeight();
}
}
21 changes: 21 additions & 0 deletions kodilla-intro/src/main/java/ApplicationUser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public class ApplicationUser {
String name;
double age;
double height;

public ApplicationUser(String name, double age, double height) {
this.name = name;
this.age = age;
this.height = height;
}

public void checkAgeAndHeight() {
if (name != null) {
if (age > 30 && height > 160) {
System.out.println("User is older than 30 and taller than 160cm");
} else {
System.out.println("User is 30 (or younger) or 160cm (or shorter)");
}
}
}
}

0 comments on commit 2448dfa

Please sign in to comment.