diff --git a/Assignment2/.classpath b/Assignment2/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..137510065ce8f746de57b1b1a8953e8c9d46b79b --- /dev/null +++ b/Assignment2/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/Assignment2/.project b/Assignment2/.project new file mode 100644 index 0000000000000000000000000000000000000000..647e0ccb4ae119e76e72d499643e16d9e427cc5a --- /dev/null +++ b/Assignment2/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Assignment2</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/Assignment2/.settings/org.eclipse.jdt.core.prefs b/Assignment2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..3a21537071bf4118b9e1ee864cb4bc258aa48211 --- /dev/null +++ b/Assignment2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Assignment2/bin/assignment2/Demo.class b/Assignment2/bin/assignment2/Demo.class new file mode 100644 index 0000000000000000000000000000000000000000..87c11dc10072b7ca40f77258480f45655ef81abb Binary files /dev/null and b/Assignment2/bin/assignment2/Demo.class differ diff --git a/Assignment2/bin/assignment2/address.class b/Assignment2/bin/assignment2/address.class new file mode 100644 index 0000000000000000000000000000000000000000..f0bed980bfd9f513c4aa7fad08392cca7322fe74 Binary files /dev/null and b/Assignment2/bin/assignment2/address.class differ diff --git a/Assignment2/bin/assignment2/customer.class b/Assignment2/bin/assignment2/customer.class new file mode 100644 index 0000000000000000000000000000000000000000..213c237b988784af43329c2c6463c2a9c89594ee Binary files /dev/null and b/Assignment2/bin/assignment2/customer.class differ diff --git a/Assignment2/bin/assignment2/person.class b/Assignment2/bin/assignment2/person.class new file mode 100644 index 0000000000000000000000000000000000000000..51c386cc5a85a336eb82ff703aacd9c1da3e625b Binary files /dev/null and b/Assignment2/bin/assignment2/person.class differ diff --git a/Assignment2/bin/assignment2/product.class b/Assignment2/bin/assignment2/product.class new file mode 100644 index 0000000000000000000000000000000000000000..f4ee4fed5b6f444b660d5559f3fc9227e4bb582c Binary files /dev/null and b/Assignment2/bin/assignment2/product.class differ diff --git a/Assignment2/bin/assignment2/venues.class b/Assignment2/bin/assignment2/venues.class new file mode 100644 index 0000000000000000000000000000000000000000..69ca6d88df599080341a52ce7caa211c7815f49f Binary files /dev/null and b/Assignment2/bin/assignment2/venues.class differ diff --git a/Assignment2/data/inputOutputExamples.zip b/Assignment2/data/inputOutputExamples.zip new file mode 100644 index 0000000000000000000000000000000000000000..6cc923c1c0b1be2d755f623c2b55a445ef3107b0 Binary files /dev/null and b/Assignment2/data/inputOutputExamples.zip differ diff --git a/Assignment2/src/assignment2/Customer.java b/Assignment2/src/assignment2/Customer.java new file mode 100644 index 0000000000000000000000000000000000000000..d4772bf37d969fecf3172bdd93c2032cf1c6244b --- /dev/null +++ b/Assignment2/src/assignment2/Customer.java @@ -0,0 +1,88 @@ +package assignment2; + + + +public class Customer { + + + private String customerCode; + private String type; + private String primaryContact; + private String name; + private String address; + + Customer(String customerCode, String type, String primaryContact, String name,String address){ + this.setCustomerCode(customerCode); + this.setType(type); + this.setPrimaryContact(primaryContact); + this.setName(name); + this.setAddress(address); + } + + public String getCustomerCode() { + return customerCode; + } + + public void setCustomerCode(String customerCode) { + this.customerCode = customerCode; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getPrimaryContact() { + return primaryContact; + } + + public void setPrimaryContact(String primaryContact) { + this.primaryContact = primaryContact; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + +} + + +/*public void readCustomer (){ + String fileName = "data/Customer.dat"; + Scanner s = null; + try { + s = new Scanner(new File(fileName)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + String customer = ""; + + while(s.hasNext()) { + customer += s.next().trim(); + } + s.close(); + + String[] parts = customer.split(";"); + String customerCode = parts[0]; + String type = parts[1]; + String primaryContact = parts[2]; //this corresponds to a person in the person class. + String name = parts[3]; + String address = parts[4]; + } + */ diff --git a/Assignment2/src/assignment2/DataConvereter.java b/Assignment2/src/assignment2/DataConvereter.java new file mode 100644 index 0000000000000000000000000000000000000000..4748e13d15b72c4a89da9bc8755c5dacc6bcafc7 --- /dev/null +++ b/Assignment2/src/assignment2/DataConvereter.java @@ -0,0 +1,89 @@ +package assignment2; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; + +public class DataConvereter { + + + public void readPerson (){ + String fileName = "data/Person.dat"; + Scanner s = null; + try { + s = new Scanner(new File(fileName)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + int size =Integer.parseInt(s.nextLine()); + for(int i=0;i<size;i++){ + String personTemp = s.nextLine(); + String[] parts = personTemp.split(";"); + String personCode = parts[0]; + String name = parts[1]; + String address = parts[2]; + String eMail = parts[3]; + Person p = new Person(personCode,name,address,eMail); + /*p.setPersonCode(personCode); + p.setName(name); + p.setAddress(address); + p.seteMail(eMail);*/ + } + s.close(); + } + + public void readVenues (){ + String fileName = "data/Venues.dat"; + Scanner s = null; + try { + s = new Scanner(new File(fileName)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + int size =Integer.parseInt(s.nextLine()); + for(int i=0;i<size;i++){ + String venueTemp = s.nextLine(); + String[] parts = venueTemp.split(";"); + String venueCode = parts[0]; + String name = parts[1]; + String address = parts[2]; + int capacity = Integer.parseInt(parts[3]); + Venues v = new Venues(venueCode,name,address,capacity); + /*v.setVenueCode(venueCode); + v.setName(name); + v.setAddress(address); + v.setCapacity(capacity);*/ + } + s.close(); + } + + public void readCustomer (){ + String fileName = "data/Customers.dat"; + Scanner s = null; + try { + s = new Scanner(new File(fileName)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + int size =Integer.parseInt(s.nextLine()); + for(int i=0;i<size;i++){ + String customerTemp = s.nextLine(); + String[] parts = customerTemp.split(";"); + String customerCode = parts[0]; + String type = parts[1]; + String primaryContact = parts[2]; + String name = parts[3]; + String address = parts[4]; + Customer c = new Customer(customerCode,type, primaryContact, name, address); + /*c.setCustomerCode(customerCode); + c.setType(type); + c.setPrimaryContact(primaryContact); + c.setName(name); + c.setAddress(address);*/ + } + s.close(); + } + + + +} diff --git a/Assignment2/src/assignment2/GameTicket.java b/Assignment2/src/assignment2/GameTicket.java new file mode 100644 index 0000000000000000000000000000000000000000..da612d3151c8efa7fc083ad0a018177ddbb71a25 --- /dev/null +++ b/Assignment2/src/assignment2/GameTicket.java @@ -0,0 +1,79 @@ +package assignment2; + +public class GameTicket { + + private String code; + private String TG; + private String venueCode; + private String dateTime; + private String team1; + private String team2; + private double pricePerUnit; + + GameTicket(String code, String TG, String venueCode, String dateTime, String team1, String team2, double pricePerUnit){ + this.code = code; + this.TG = TG; + this.venueCode = venueCode; + this.dateTime = dateTime; + this.team1 = team1; + this.team2 = team2; + this.pricePerUnit = pricePerUnit; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getTG() { + return TG; + } + + public void setTG(String TG) { + this.TG = TG; + } + + public String getVenueCode() { + return venueCode; + } + + public void setVenueCode(String venueCode) { + this.venueCode = venueCode; + } + + public String getDateTime() { + return dateTime; + } + + public void setDateTime(String dateTime) { + this.dateTime = dateTime; + } + + public String getTeam1() { + return team1; + } + + public void setTeam1(String team1) { + this.team1 = team1; + } + + public String getTeam2() { + return team2; + } + + public void setTeam2(String team2) { + this.team2 = team2; + } + + public double getPricePerUnit() { + return pricePerUnit; + } + + public void setPricePerUnit(double pricePerUnit) { + this.pricePerUnit = pricePerUnit; + } +} + diff --git a/Assignment2/src/assignment2/PSL.java b/Assignment2/src/assignment2/PSL.java new file mode 100644 index 0000000000000000000000000000000000000000..b4f02daf335c909bbc3b6982b2949b22e62a1d17 --- /dev/null +++ b/Assignment2/src/assignment2/PSL.java @@ -0,0 +1,73 @@ +package assignment2; + + + +public class PSL { + + private String code; + private String SL; + private String ticketCode; + private double licenseFee; + + + + PSL(String code, String SL, String ticketCode, double licenseFee){ + this.setCode(code); + this.setSL(SL); + this.setTicketCode(ticketCode); + this.setLicenseFee(licenseFee); + } + + + + public void setLicenseFee(double licenseFee) { + this.licenseFee = licenseFee; + } + + + + public double getLicenseFee() { + return licenseFee; + } + + + + public void setTicketCode(String ticketCode) { + this.ticketCode = ticketCode; + } + + + + public String getTicketCode() { + return ticketCode; + } + + + + public void setSL(String sL) { + SL = sL; + } + + + + public String getSL() { + return SL; + } + + + + public void setCode(String code) { + this.code = code; + } + + + + public String getCode() { + return code; + } + + +} + + + diff --git a/Assignment2/src/assignment2/ParkingPass.java b/Assignment2/src/assignment2/ParkingPass.java new file mode 100644 index 0000000000000000000000000000000000000000..c58a33a6fbd768da17fcae568da4d67c446e1ed9 --- /dev/null +++ b/Assignment2/src/assignment2/ParkingPass.java @@ -0,0 +1,49 @@ +package assignment2; + +public class ParkingPass { + + private String code; + private String SP; + private String venueCode; + private double hourlyFee; + + ParkingPass(String code, String SP, String venueCode, double hourlyFee){ + this.setCode(code); + this.setSP(SP); + this.setVenueCode(venueCode); + this.setHourlyFee(hourlyFee); + + } + + public void setHourlyFee(double hourlyFee) { + this.hourlyFee = hourlyFee; + } + + public double getHourlyFee() { + return hourlyFee; + } + + public void setVenueCode(String venueCode) { + this.venueCode = venueCode; + } + + public String getVenueCode() { + return venueCode; + } + + public void setSP(String sP) { + SP = sP; + } + + public String getSP() { + return SP; + } + + public void setCode(String code) { + this.code = code; + } + + public String getCode() { + return code; + } +} diff --git a/Assignment2/src/assignment2/Person.java b/Assignment2/src/assignment2/Person.java new file mode 100644 index 0000000000000000000000000000000000000000..f9fbe80572d50acade968ffcaac590fc5e971db5 --- /dev/null +++ b/Assignment2/src/assignment2/Person.java @@ -0,0 +1,88 @@ +package assignment2; + + + +public class Person { + + private String personCode; + private String name; + private String address; + private String eMail; + + + + + + public Person(String personCode, String name, String address, String eMail) { + this.setPersonCode(personCode); + this.setName(name); + this.setAddress(address); + this.seteMail(eMail); + } + + + + + + public String getPersonCode() { + return personCode; + } + + + + + + public void setPersonCode(String personCode) { + this.personCode = personCode; + } + + + + + + public String getName() { + return name; + } + + + + + + public void setName(String name) { + this.name = name; + } + + + + + + public String getAddress() { + return address; + } + + + + + + public void setAddress(String address) { + this.address = address; + } + + + + + + public String geteMail() { + return eMail; + } + + + + + + public void seteMail(String eMail) { + this.eMail = eMail; + } + +} + diff --git a/Assignment2/src/assignment2/Refreshments.java b/Assignment2/src/assignment2/Refreshments.java new file mode 100644 index 0000000000000000000000000000000000000000..26cc66a87f3d46240d6457180b16b33a0105ef96 --- /dev/null +++ b/Assignment2/src/assignment2/Refreshments.java @@ -0,0 +1,5 @@ +package assignment2; + +public class Refreshments { + +} diff --git a/Assignment2/src/assignment2/SeasonPass.java b/Assignment2/src/assignment2/SeasonPass.java new file mode 100644 index 0000000000000000000000000000000000000000..c306fdd21e8097f091ad12f4731bb640c761c7d5 --- /dev/null +++ b/Assignment2/src/assignment2/SeasonPass.java @@ -0,0 +1,81 @@ +package assignment2; + +public class SeasonPass { + + private String code; + private String TS; + private String team; + private String startDate; + private String endDate; + private double cost; + + + SeasonPass(String code, String TS, String team, String startDate, String endDate, double cost){ + this.code = code; + this.TS = TS; + this.team = team; + this.startDate = startDate; + this.endDate = endDate; + this.cost = cost; + } + + + public String getCode() { + return code; + } + + + public void setCode(String code) { + this.code = code; + } + + + public String getTS() { + return TS; + } + + + public void setTS(String tS) { + TS = tS; + } + + + public String getTeam() { + return team; + } + + + public void setTeam(String team) { + this.team = team; + } + + + public String getStartDate() { + return startDate; + } + + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + + public String getEndDate() { + return endDate; + } + + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + + public double getCost() { + return cost; + } + + + public void setCost(double cost) { + this.cost = cost; + } +} \ No newline at end of file diff --git a/Assignment2/src/assignment2/Venues.java b/Assignment2/src/assignment2/Venues.java new file mode 100644 index 0000000000000000000000000000000000000000..08a8f9fc65ba672dbfe3cbe986215dfb368e116f --- /dev/null +++ b/Assignment2/src/assignment2/Venues.java @@ -0,0 +1,86 @@ +package assignment2; + + + +public class Venues { + + private String venueCode; + private String name; + private String address; + private int capacity; + + + public Venues(String venueCode, String name, String address, int capacity){ + this.setVenueCode(venueCode); + this.setName(name); + this.setAddress(address); + this.setCapacity(capacity); + } + + + public String getVenueCode() { + return venueCode; + } + + + public void setVenueCode(String venueCode) { + this.venueCode = venueCode; + } + + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public String getAddress() { + return address; + } + + + public void setAddress(String address) { + this.address = address; + } + + + public int getCapacity() { + return capacity; + } + + + public void setCapacity(int capacity) { + this.capacity = capacity; + } + +} + + + + +/*public void readVenues (){ +String fileName = "data/Venues.dat"; +Scanner s = null; +try { + s = new Scanner(new File(fileName)); +} catch (FileNotFoundException e) { + e.printStackTrace(); +} + +String venue = ""; + +while(s.hasNext()) { + venue += s.next().trim(); +} +s.close(); + +String[] parts = venue.split(";"); +String venueCode = parts[0]; +String name = parts[1]; +String address = parts[2]; +String capacity = parts[3]; +}*/ \ No newline at end of file diff --git a/Assignment2/src/assignment2/address.java b/Assignment2/src/assignment2/address.java new file mode 100644 index 0000000000000000000000000000000000000000..a1b0cdad37f97dc3a72b353926bf6be0fc98c997 --- /dev/null +++ b/Assignment2/src/assignment2/address.java @@ -0,0 +1,5 @@ +package assignment2; + +public class address { + +} diff --git a/homework-2/src/homework2/persons.java b/homework-2/src/homework2/persons.java index ae29ea3cdb6019b4c3b1170982b2ee8b4ab69eb7..24f05fbba2312d71706e573fdd04ed325b75a55a 100644 --- a/homework-2/src/homework2/persons.java +++ b/homework-2/src/homework2/persons.java @@ -1,6 +1,6 @@ package homework2; public class persons { -// new persons class - // working + public static void main(String args[]) { + }