Skip to content

Instantly share code, notes, and snippets.

@GrunclePug
Created May 26, 2019 08:13
Show Gist options
  • Save GrunclePug/ab2de33bdf459dde164671e92ad634ce to your computer and use it in GitHub Desktop.
Save GrunclePug/ab2de33bdf459dde164671e92ad634ce to your computer and use it in GitHub Desktop.
COMP 1409 | Lab01
/**
* 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