From 0f5875018eb88fd31ae3a7e0858ad9f675b2e4bc Mon Sep 17 00:00:00 2001 From: cdr23859 <cdr23859@creighton.edu> Date: Fri, 15 Sep 2017 19:50:33 -0500 Subject: [PATCH] Add files via upload --- bin/unl/cse/parking/Garage.class | Bin 0 -> 1899 bytes bin/unl/cse/parking/GarageSimulation.class | Bin 0 -> 808 bytes bin/unl/cse/parking/Vehicle.class | Bin 0 -> 471 bytes src/unl/cse/parking/Garage.java | 81 +++++++++++++++++++++ src/unl/cse/parking/GarageSimulation.java | 14 ++++ src/unl/cse/parking/Vehicle.java | 21 ++++++ 6 files changed, 116 insertions(+) create mode 100644 bin/unl/cse/parking/Garage.class create mode 100644 bin/unl/cse/parking/GarageSimulation.class create mode 100644 bin/unl/cse/parking/Vehicle.class create mode 100644 src/unl/cse/parking/Garage.java create mode 100644 src/unl/cse/parking/GarageSimulation.java create mode 100644 src/unl/cse/parking/Vehicle.java diff --git a/bin/unl/cse/parking/Garage.class b/bin/unl/cse/parking/Garage.class new file mode 100644 index 0000000000000000000000000000000000000000..da99e9488f2e66c3c9850c534ea507fbcf3be040 GIT binary patch literal 1899 zcmX^0Z`VEs1_mRBP<93;Mh3Ccyd3@H;#B>D#G>rXymWo{#G=IXRCWdyMh1bb#Ii*F zoW#6zegCAa)Z`LI2Dajo#GIUBMh2;9A9S5zsTrBcIjPo+3~V-;d6^}4j0`Lqo|<8d z3@pz1DXClx%naN-4D1X%j10^gnqlk=e2fg@I1J%rU}O;BVPIuoV`Sj>$;?ajE6q(x zEec6Y%1LEp5c0`SPRt2QEXoA&p@J+W8JWe53=$abg80aqk%1#Qu^=%yv!s%dfzgwZ zfh#d31?px-1{n<ueNZ`T%_xxC(vtk#{G?2f^^!Q1GBWTMrRL_Br9$;GGU#gfAVM*? zq$o2l-C7fme)gQq<kY-kuqQDzGBR+dr<ORweZj1u>B-2zpPpLcSDNcql$sh`kY7^F z$iSI~U^8YiGVlhMBqnG3CKf=0iY+lE#U-(lk%2w0G}k4uvY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9z`?-4;LgCo;K9Jl;K?Ay;KiWF;LTvj;LDK3;K5MF5P;;V fa;T@c7;?bj%g6u;UzR@%yo|~gpzsX_2Tlk8Pc3>s literal 0 HcmV?d00001 diff --git a/bin/unl/cse/parking/GarageSimulation.class b/bin/unl/cse/parking/GarageSimulation.class new file mode 100644 index 0000000000000000000000000000000000000000..a997d153614876a1df2e8ed404d2b4f6c06a49d4 GIT binary patch literal 808 zcmX^0Z`VEs1_mPrJ$42rMh1n_yd3@H;#B>D#G>rXymWo{#G=IX)ZonA(wxMS%=|od z1{OvJfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk-5<5l)W)00SMg|t={FGEK24)6M9tKth zHbw@1pUk{eztY^K)S{5Yq?}Yn1|gsP<iwn?#G*_PA1cUFl95@=$e`py$Q{;<3@o{c znR$#1Vj9st2=@e+6lLb6TWf}~GYB#=h+#K|i$Q=v800V!Mg|rQPmp3UMh0<o#bK!# znaMe+91IeS4D9}H0SXqT=3ES-3{oJi(u@qE8rUob87|AiAjcrj$iS7Dk^(h_kwHcS z!&gu_Yt1N-E=3*&B~VzgC8ngfBvyiiRCpLvK|;JKnZ*S;iIqXA1^GoKj0`M^Md`(i z48mBv&d9(~oS2pxkXV$>$RL4XB_u+v85!6zQj3x@QyCc~G1S1E#mK-FoL^d$oa&Yd ziZM}$UPNNh1BE+-A_F4>GXn@PF))H+n}Lymoq>TtpMjBqk%57MRcku~$3_MQ1||kB z1_lN;upl!7Hv<C$517r$z{9}Hz`(%Cz{kK3)!fR!3^r7IH-kW=0M~W~A)nn0qLD)4 z+ZiN%wRN^J$b@TeV^BcC$_Oiz7&yQdaWSwnh%j(4NHK6S$T4s+C^2v|s4?&`Xfg1D otyh3p!Jx*V&cMLH#h}Qb!Jx^&$RNTX&Y;Dh%>eR`4%p$k00~I4761SM literal 0 HcmV?d00001 diff --git a/bin/unl/cse/parking/Vehicle.class b/bin/unl/cse/parking/Vehicle.class new file mode 100644 index 0000000000000000000000000000000000000000..33e97184ac2b2e1cc251f4b8bca7ff3c4b3a5803 GIT binary patch literal 471 zcmX^0Z`VEs1_mPradrkKMh5ZHyd3@H;#B>D#G>rXymbAr)QrsJoK$uO7Dfhvti-ZJ z{hY+SbbbG%tkmQZMh5nr%;eO(;#5WkAs>Wna7j^SUb;0S1Dj1|US^3MBZH_0rnF`l zBLj<beo87A12Y3R4+A>`4<iG!hGrNi10w?;4+AR$8zTe1Pi9`KUukYqYEejHQV!Un z{N%)(u*9NF5FaYYQj(Eb%*Y_=gTwvSj0{}qsU<!z*NSLpVmgSCfh#z_v?w{%EfZuB z57h5^AdfL9GB7eQGcYhPG6;cO#=yY9#K6eF&cMOI$iT_Kz~IKf#K6SBz`&)ooq<bB zdn*I)Mz9)w1_lN`uucvJ76wiRP6jRp0R{#JF^FmgK?WfP5a0rv%E-XTAj}{FHB+Af l#Aje&)!M?qy8&(-8v`Q)1A`FQ7#=X26>1D4gD6;)7yz!=TEYMT literal 0 HcmV?d00001 diff --git a/src/unl/cse/parking/Garage.java b/src/unl/cse/parking/Garage.java new file mode 100644 index 0000000..ab68bdb --- /dev/null +++ b/src/unl/cse/parking/Garage.java @@ -0,0 +1,81 @@ +package unl.cse.parking; + +public class Garage { + + private final Vehicle stalls[]; + + public Garage(int capacity) { + stalls = new Vehicle[capacity]; + } + + /** + * "Parks" the vehicle in a stall if one is available. Returns true if + * the vehicle was added successfully; false otherwise. + */ + public boolean addVehicle(Vehicle automobile) { + //TODO: implement this method + return false; + } + + /** + * Remove the vehicle having the provided + * license plate number from the garage. The method returns + * the vehicle if it is found otherwise it returns null. + */ + public Vehicle removeVehicle(String license) { + //TODO: implement this method + return null; + } + + /** + * Returns the maximum capacity of this Garage + */ + public int getCapacity() { + return this.stalls.length; + } + + /** + * Returns the number of empty stalls in the garage--the number of open + * spots + * @return + */ + public int getNumFreeSpots() { + int freeSpots = 0; + for(int i=0; i<stalls.length; i++) { + if(stalls[i] == null) { + freeSpots++; + } + } + return freeSpots; + } + + /** + * Simulates the passing of a day by adding a day in the garage to each vehicle + * in the garage. + * @return + */ + public void addDay() { + //TODO: implement this + } + + public void addDay(int numDays) { + //TODO: optionally implement this as well + } + + /** + * Displays the current "state" of the garage by printing out information about each + * stall + */ + public void displayReport() { + + System.out.println("Stall License Type Days Total Fee"); + for(int i=0; i<this.stalls.length; i++) { + if(stalls[i] == null) { + System.out.println(String.format("%3d EMPTY", (i+1))); + } else { + //TODO: You will need to modify these arguments to display the report correctly + System.out.println(String.format("%3d %-10s %-11s %3d $%5.2f", (i+1), stalls[i].getLicense(), "TODO-TYPE", -1, -1.0)); + } + } + } +} \ No newline at end of file diff --git a/src/unl/cse/parking/GarageSimulation.java b/src/unl/cse/parking/GarageSimulation.java new file mode 100644 index 0000000..05d2b46 --- /dev/null +++ b/src/unl/cse/parking/GarageSimulation.java @@ -0,0 +1,14 @@ +package unl.cse.parking; + +public class GarageSimulation { + public static void main(String[] args) { + + Garage safePark = new Garage(10); + Vehicle herbie = new Vehicle("OFP 857"); + safePark.addVehicle(herbie); + safePark.addDay(); + safePark.addDay(); + safePark.addDay(); + safePark.displayReport(); + } +} diff --git a/src/unl/cse/parking/Vehicle.java b/src/unl/cse/parking/Vehicle.java new file mode 100644 index 0000000..97834a2 --- /dev/null +++ b/src/unl/cse/parking/Vehicle.java @@ -0,0 +1,21 @@ +package unl.cse.parking; + +public class Vehicle { + + private final String license; + + // The class constructor + public Vehicle(String license) { + this.license = license; + } + + /** + * The getter method granting public access to reading the + * license plate number. Notice license does not have a + * setter since it cannot be modified. + */ + public String getLicense() { + return license; + } + +} -- GitLab