Created
May 26, 2019 08:13
-
-
Save GrunclePug/ab2de33bdf459dde164671e92ad634ce to your computer and use it in GitHub Desktop.
COMP 1409 | Lab01
This file contains hidden or 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
/** | |
* Class that models a Person. | |
* | |
* @author Chad | |
* @version 1.0 | |
*/ | |
public class Person | |
{ | |
String firstName; | |
String lastName; | |
int age; | |
double height; // cm | |
/** | |
* Constructor for the Person. | |
* | |
* @param _firstName The First name of the Person. | |
* @param _lastName The last name of the Person. | |
* @param _age The age of the Person, must be between 1 and 100 inclusively. | |
* @param _height The height of the Person (in cm), must be between 1 and 200 inclusively. | |
* | |
*/ | |
Person(String _firstName, String _lastName, int _age, double _height) | |
{ | |
firstName = _firstName; | |
lastName = _lastName; | |
if(_age > 0 && _age <= 100) | |
{ | |
age = _age; | |
} | |
else | |
{ | |
age = 1; | |
} | |
if(_height > 0 && _height <= 200) | |
{ | |
height = _height; | |
} | |
else | |
{ | |
height = 150; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment