Clinica - AlbertProfe/Java_AppWeb_Spring_2021 GitHub Wiki
Clinica
The first step to creating our exercise. Just 5 classes:
- Clinica.java
- MainApplication.java
- MyDate.java
- Person.java
- Test.java
Test Class got two static methods to test: testObjects and testConstructorMethod
public static void testObjects()
let's create and test some objects Person and Clinica and add Person Jose to Clinica as a Member
public static void testConstructorMethod()
let's create and test some objects Person with the same ORDER arguments which may cause trouble at constructor so we will create two methods which will call the constructor and return and Person object so: call method > method > call constructor > create object > method return object

we create Test class to simplify MainApp:

and Person:

and how we solve overloading Constructor confusing call, with a builder pattern:
thanks to class Person we may create an object called toni (or laura) with a
static methodthat calls the REAL constructor which creates the REAL object (thestatic methodjust makes the call) without age or weight (confusing parameters due to the order at parameters list), so we may create two objects, one with age and another with weight.

watch out on toni object the second parameter: 18 is an
intage
watch out on laura object the second parameter: 18 is NOT an
intage, it is anintweight
Person toni = Person.personConstructorAge("Toni Lopez", 18, 1,1,1980);
Person laura = Person.personConstructorWeigth("Laura Gasol", 60, 1,7,1992);
