-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ApplicationUser and Application classes
- Loading branch information
1 parent
ea825eb
commit 2448dfa
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)"); | ||
} | ||
} | ||
} | ||
} |