From 469cc51a11f508f4b1b85c48ac09a885fa9056e4 Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Tue, 21 Mar 2023 19:00:48 +0000 Subject: [PATCH] [POO] removed regex for names --- 1ano/2semestre/poo/src/aula06/Person.java | 2 -- 1ano/2semestre/poo/src/aula06/PersonTest.java | 6 +++--- 1ano/2semestre/poo/src/aula06/Professor.java | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/1ano/2semestre/poo/src/aula06/Person.java b/1ano/2semestre/poo/src/aula06/Person.java index a259876..4744bad 100644 --- a/1ano/2semestre/poo/src/aula06/Person.java +++ b/1ano/2semestre/poo/src/aula06/Person.java @@ -19,8 +19,6 @@ public class Person { public void setName(String name) { if (name == null || name.isEmpty()) throw new IllegalArgumentException("Name cannot be null or empty"); - if (!name.matches("^[a-zA-Z ]+$")) - throw new IllegalArgumentException("Name must only contain letters and spaces"); this.name = name; } diff --git a/1ano/2semestre/poo/src/aula06/PersonTest.java b/1ano/2semestre/poo/src/aula06/PersonTest.java index 134b306..423cf59 100644 --- a/1ano/2semestre/poo/src/aula06/PersonTest.java +++ b/1ano/2semestre/poo/src/aula06/PersonTest.java @@ -7,9 +7,9 @@ public class PersonTest { public static void main(String[] args) { Scanner sin = new Scanner(System.in); - Student al = new Student ("Andreia Melo", 9855678,new DateYMD(18, 7, 1990), new DateYMD(1, 9, 2018)); - Professor p1 = new Professor("Jorge Almeida", 3467225, new DateYMD(13, 3, 1967), "Associado", "Informática"); - Bolser bls = new Bolser ("Igor Santos", 8976543, new DateYMD(11, 5, 1985), p1, 900); + Student al = new Student ("Andreia Melo", 98556781,new DateYMD(18, 7, 1990), new DateYMD(1, 9, 2018)); + Professor p1 = new Professor("Jorge Almeida", 34672215, new DateYMD(13, 3, 1967), "Associado", "Informática"); + Bolser bls = new Bolser ("Igor Santos", 89765431, new DateYMD(11, 5, 1985), p1, 900); bls.setMonthlyAmount(1050); System.out.println("Student:"+ al.getName()); System.out.println(al); diff --git a/1ano/2semestre/poo/src/aula06/Professor.java b/1ano/2semestre/poo/src/aula06/Professor.java index 1dd9a16..00e59c1 100644 --- a/1ano/2semestre/poo/src/aula06/Professor.java +++ b/1ano/2semestre/poo/src/aula06/Professor.java @@ -29,8 +29,6 @@ public class Professor extends Person { public void setDepartment(String department) { if (department == null || department.isEmpty()) throw new IllegalArgumentException("Department cannot be null or empty"); - if (!department.matches("^[a-zA-Z ]+$")) - throw new IllegalArgumentException("Invalid department"); this.department = department; }