diff --git a/src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java b/src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java new file mode 100644 index 0000000..d84c60c --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java @@ -0,0 +1,20 @@ +package hs.fulda.de.ci.exam.project; + +public class FlightSeat extends Seat { + private String reservationNumer; + private double fare; + + public FlightSeat(double fare, String reservationNumer) { + super(); + this.fare = fare; + this.reservationNumer = reservationNumer; + } + + public double getFare() { + return this.fare; + } + + public String getReservationNumber() { + return this.reservationNumer; + } +} diff --git a/src/main/java/hs/fulda/de/ci/exam/project/Seat.java b/src/main/java/hs/fulda/de/ci/exam/project/Seat.java new file mode 100644 index 0000000..1967565 --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/Seat.java @@ -0,0 +1,40 @@ +package hs.fulda.de.ci.exam.project; + +public class Seat { + private SeatClass seatClass; + private SeatType seatType; + private String seatNumber; + + public Seat(String seatNumber, SeatType seatType, SeatClass seatClass) { + this.seatNumber = seatNumber; + this.seatType = seatType; + this.seatClass = seatClass; + } + public Seat(){ + + } + + public SeatClass getSeatClass() { + return seatClass; + } + + public void setSeatClass(SeatClass seatClass) { + this.seatClass = seatClass; + } + + public SeatType getSeatType() { + return seatType; + } + + public void setSeatType(SeatType seatType) { + this.seatType = seatType; + } + + public String getSeatNumber() { + return seatNumber; + } + + public void setSeatNumber(String seatNumber) { + this.seatNumber = seatNumber; + } +} diff --git a/src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java b/src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java new file mode 100644 index 0000000..fec9a4a --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java @@ -0,0 +1,5 @@ +package hs.fulda.de.ci.exam.project; + +public enum SeatClass { + Economy, EconomyPlus, PreferredEconomy, Business, FirstClass +} diff --git a/src/main/java/hs/fulda/de/ci/exam/project/SeatType.java b/src/main/java/hs/fulda/de/ci/exam/project/SeatType.java new file mode 100644 index 0000000..c5d76a0 --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/SeatType.java @@ -0,0 +1,5 @@ +package hs.fulda.de.ci.exam.project; + +public enum SeatType { + Regular, Accessible, EmergencyExit, ExtraLegRoom +} diff --git a/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java b/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java new file mode 100644 index 0000000..e9c4400 --- /dev/null +++ b/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java @@ -0,0 +1,29 @@ +package hs.fulda.de.ci.exam.project; + +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class SeatTest { + @Test + public void testIfConstructorSetsValues() { + FlightSeat fSeat = new FlightSeat(100.0, "1234"); + assertThat(fSeat.getFare()).isEqualTo(100.0); + assertThat(fSeat.getReservationNumber()).isEqualTo("1234"); + } + + @Test + public void testParentSeatClassConstructor() { + Seat seat = new Seat("14F", SeatType.Regular, SeatClass.Economy); + assertThat(seat.getSeatNumber()).isEqualTo("14F"); + assertThat(seat.getSeatType()).isEqualTo(SeatType.Regular); + assertThat(seat.getSeatClass()).isEqualTo(SeatClass.Economy); + } + + @Test + public void testMakingFlightTestParentClass(){ + Seat seat = new FlightSeat(100.0, "1234"); + assertThat(((FlightSeat) seat).getFare()).isEqualTo(100.0); + assertThat(((FlightSeat) seat).getReservationNumber()).isEqualTo("1234"); + } +} diff --git a/target/classes/hs/fulda/de/ci/exam/project/Itinerary.class b/target/classes/hs/fulda/de/ci/exam/project/Itinerary.class index b5fe1ba..b7c1f85 100644 Binary files a/target/classes/hs/fulda/de/ci/exam/project/Itinerary.class and b/target/classes/hs/fulda/de/ci/exam/project/Itinerary.class differ diff --git a/target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class b/target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class index 2193c80..1b55663 100644 Binary files a/target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class and b/target/test-classes/hs/fulda/de/ci/exam/project/CustomerTest.class differ