From 8fa85ab30e09f68eb9550fe59127fcee2ce40c42 Mon Sep 17 00:00:00 2001 From: Imron Date: Mon, 7 Feb 2022 12:19:18 +0100 Subject: [PATCH 1/3] FlightSeat --- .../fulda/de/ci/exam/project/FlightSeat.java | 19 +++++++++++++++++++ .../hs/fulda/de/ci/exam/project/SeatTest.java | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java create mode 100644 src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java 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..29b33e4 --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java @@ -0,0 +1,19 @@ +package hs.fulda.de.ci.exam.project; + +public class FlightSeat { + private String reservationNumer; + private double fare; + + public FlightSeat(double fare, String reservationNumer) { + this.fare = fare; + this.reservationNumer = reservationNumer; + } + + public double getFare() { + return this.fare; + } + + public String getReservationNumber() { + return this.reservationNumer; + } +} 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..b48e261 --- /dev/null +++ b/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java @@ -0,0 +1,14 @@ +package hs.fulda.de.ci.exam.project; + +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class SeatTest { + @Test + void testIfConstructorSetsValues() { + FlightSeat fSeat = new FlightSeat(100.0, "1234"); + assertThat(fSeat.getFare()).isEqualTo(100.0); + assertThat(fSeat.getReservationNumber()).isEqualTo("1234"); + } +} From b1a36a043c4366020421cb2bac6ac7874a466e5c Mon Sep 17 00:00:00 2001 From: Imron Date: Mon, 7 Feb 2022 12:29:07 +0100 Subject: [PATCH 2/3] parent class seat --- .../hs/fulda/de/ci/exam/project/Seat.java | 37 ++++++++++++++++++ .../fulda/de/ci/exam/project/SeatClass.java | 5 +++ .../hs/fulda/de/ci/exam/project/SeatType.java | 5 +++ .../hs/fulda/de/ci/exam/project/SeatTest.java | 10 ++++- .../fulda/de/ci/exam/project/Itinerary.class | Bin 484 -> 3662 bytes .../de/ci/exam/project/CustomerTest.class | Bin 3836 -> 3891 bytes 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/main/java/hs/fulda/de/ci/exam/project/Seat.java create mode 100644 src/main/java/hs/fulda/de/ci/exam/project/SeatClass.java create mode 100644 src/main/java/hs/fulda/de/ci/exam/project/SeatType.java 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..8aab462 --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/Seat.java @@ -0,0 +1,37 @@ +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 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 index b48e261..a249aca 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java @@ -6,9 +6,17 @@ import static org.assertj.core.api.Assertions.assertThat; public class SeatTest { @Test - void testIfConstructorSetsValues() { + 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); + } } 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 b5fe1ba8ef51670112477b039ee047c692174354..b7c1f859092a3a78e8b5baa4fab8598b5097b55a 100644 GIT binary patch literal 3662 zcmbVOYjYD-7=AWMn>N|fl5%OqOOO`YloCKILJArJfzoo3A_$0hNVd(ko87p(sT41G zzy1Ng`awQ1jyh5XobiL79DkJKb9T4QtqqKmnX`M&zVGwipOb(7ef%eYL-;<1L7eNx z0M5(hf?VE^%f&cmaVc{AZy<&@aXE%7cq@`k%IyHIcHvqiTLHRp9d9QH^==FTx4Ka1 zLNNhF?guaz#e57~aZZAjqR^vQP|)MJ!gg;8-L6=+t6+Ghk)u)HLiILH|M9%1r zOR?@*eclvq)u!QGi@;=Cb1jL?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#Cd;LxWk4`xu#o$6<%uxHDrXrOMC zp?0+6#u7t0wIzm`>gRseiR0E>?c(xTD%u*&5QwLDgzD@dHSHrz&qjZh&nOHsyE#6> ztZZY0a}(*R_yBixrmGU}sJ}*Pm^zOk>eIudeOze501eH_L{)Nt#z}LAXzCYq3^&dk z%49PbiB&1NQW9&v*>(0D%r{dJg6B` zDtt&@OkgW`m<>|UK|UfcAu!8ERU~;-Xik$cj80*Uy>;sCzu$|~!DrK`%}yQ-k5}Sm MeYb4E+rid<0l8|ZY5)KL From d2789b3e6599599f6722df5fbcdbe0d270df9fc9 Mon Sep 17 00:00:00 2001 From: Imron Date: Mon, 7 Feb 2022 14:49:38 +0100 Subject: [PATCH 3/3] making flightseat child of seat --- src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java | 3 ++- src/main/java/hs/fulda/de/ci/exam/project/Seat.java | 3 +++ src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) 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 index 29b33e4..d84c60c 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java +++ b/src/main/java/hs/fulda/de/ci/exam/project/FlightSeat.java @@ -1,10 +1,11 @@ package hs.fulda.de.ci.exam.project; -public class FlightSeat { +public class FlightSeat extends Seat { private String reservationNumer; private double fare; public FlightSeat(double fare, String reservationNumer) { + super(); this.fare = fare; this.reservationNumer = 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 index 8aab462..1967565 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/Seat.java +++ b/src/main/java/hs/fulda/de/ci/exam/project/Seat.java @@ -10,6 +10,9 @@ public class Seat { this.seatType = seatType; this.seatClass = seatClass; } + public Seat(){ + + } public SeatClass getSeatClass() { return seatClass; 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 index a249aca..e9c4400 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/SeatTest.java @@ -19,4 +19,11 @@ public class SeatTest { 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"); + } }