Skip to content

Commit 78251e3

Browse files
committed
exercise complete
1 parent 5451588 commit 78251e3

1 file changed

Lines changed: 51 additions & 4 deletions

File tree

  • src/main/java/org/launchcode/codingevents/models

src/main/java/org/launchcode/codingevents/models/Event.java

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package org.launchcode.codingevents.models;
22

3-
import jakarta.validation.constraints.Email;
4-
import jakarta.validation.constraints.NotBlank;
5-
import jakarta.validation.constraints.Size;
3+
import jakarta.validation.constraints.*;
64

75
import java.util.Objects;
86

@@ -25,11 +23,28 @@ public class Event {
2523
@Email(message = "Invalid email. Try again.")
2624
private String contactEmail;
2725

28-
public Event(String name, String description, String contactEmail) {
26+
@NotBlank(message = "Please enter an address.")
27+
private String location;
28+
29+
@AssertTrue(message = "This must be yes/true")
30+
private boolean isRegRequired;
31+
32+
@NotBlank(message = "Number of attendees is required.")
33+
@Positive( message = "There must be at least 1 attendee")
34+
private int numAttendees;
35+
36+
@PositiveOrZero(message = "Entry fee cannot be negative, but may be $0.")
37+
private int entryFee;
38+
39+
public Event(String name, String description, String contactEmail, String location, boolean isRegRequired, int numAttendees, int entryFee) {
2940
this();
3041
this.name = name;
3142
this.description = description;
3243
this.contactEmail = contactEmail;
44+
this.location = location;
45+
this.isRegRequired = isRegRequired;
46+
this.numAttendees = numAttendees;
47+
this.entryFee = entryFee;
3348
}
3449

3550
public Event() {
@@ -61,6 +76,38 @@ public void setContactEmail(String contactEmail) {
6176
this.contactEmail = contactEmail;
6277
}
6378

79+
public String getLocation() {
80+
return location;
81+
}
82+
83+
public void setLocation(String location) {
84+
this.location = location;
85+
}
86+
87+
public boolean isRegRequired() {
88+
return isRegRequired;
89+
}
90+
91+
public void setRegRequired(boolean regRequired) {
92+
this.isRegRequired = regRequired;
93+
}
94+
95+
public int getNumAttendees() {
96+
return numAttendees;
97+
}
98+
99+
public void setNumAttendees(int numAttendees) {
100+
this.numAttendees = numAttendees;
101+
}
102+
103+
public int getEntryFee() {
104+
return entryFee;
105+
}
106+
107+
public void setEntryFee(int entryFee) {
108+
this.entryFee = entryFee;
109+
}
110+
64111
public int getId() {
65112
return id;
66113
}

0 commit comments

Comments
 (0)