Skip to content

Commit e13c3d8

Browse files
committed
feat: implements NoSponsorsException
1 parent 515bf43 commit e13c3d8

File tree

1 file changed

+2
-2
lines changed
  • lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/evanphilakhong

1 file changed

+2
-2
lines changed

lesson_16/objects/objects_app/src/main/java/com/codedifferently/lesson16/evanphilakhong/Formula1Car.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public Formula1Car(Team team, String[] sponsors, String driverName, int driverNu
3636
}
3737

3838
// methods
39-
public void printSponsors() {
39+
public void printSponsors() throws NoSponsorsException {
4040
if (sponsors.length == 0) {
41-
System.out.println("There are no Sponsors");
41+
throw new NoSponsorsException(team + " has no Sponsors");
4242
} else {
4343
System.out.println("Here's a list of our Sponsors:");
4444
for (String sponsor : sponsors) {

0 commit comments

Comments
 (0)