diff --git a/.classpath b/.classpath
index 6cb43ce..51a8bba 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
-
-
-
+
+
+
diff --git a/.project b/.project
deleted file mode 100644
index 64ef8ea..0000000
--- a/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- SW2
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/.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/AdminAccounts.txt b/AdminAccounts.txt
index 22f3d28..37f68ec 100644
--- a/AdminAccounts.txt
+++ b/AdminAccounts.txt
@@ -1,3 +1 @@
boss_|123456
-toka_|123456789
-salma3|123456
diff --git a/Brands.txt b/Brands.txt
index 6d2f91a..df6575d 100644
--- a/Brands.txt
+++ b/Brands.txt
@@ -3,7 +3,5 @@ airpods|mobileaccessories
Moro|food
Loreal|haircare
Pantene|haircare
-Clear|haircare
+Clear|haircareh&m|clothes
hp|electronices
-lenovo|electronices
-iphone|electronices
diff --git a/BuyedProduct.txt b/BuyedProduct.txt
index 6fdc1d5..95dcafc 100644
--- a/BuyedProduct.txt
+++ b/BuyedProduct.txt
@@ -1,3 +1,15 @@
-mai_ibrahim|nada_hatem|Shampo|1|Clear|190|Haram
-nesma_thabet|salma2|chocolate|1|Moro|19.0|ll
-nada_hatem|salma2|chocolate|2|Moro|14.0|Haram
+Shampo|2|Loreal|122 Dokki
+Shampo|2|Loreal|Mesadk
+Shampo|1|Loreal|Sharm
+Shampo|2|Loreal|Dokki
+Shampo|2|Loreal|Haram
+Shampo|2|Clear|Giza
+Shampo|2|Clear|Kafr elshikh
+Shampo|4|Pantene|Haram
+Shampo|3|Clear|Maddi
+Shampo|2|Loreal|122 Dokki
+Shampo|1|Loreal|Haram
+Shampo|1|Clear|Octobar
+Shampo|4|Clear|Octobar
+Shampo|3|Clear|Sheikh Zayed
+Shampo|1|Pantene|Luxur
diff --git a/Collaborator.txt b/Collaborator.txt
index 106a989..b5c290f 100644
--- a/Collaborator.txt
+++ b/Collaborator.txt
@@ -1,5 +1,4 @@
-noran|123456
-NesmaHatem|159753
-merret|123456
-laila|123456
-sahar_|123456789
+nesma_thabet|noran|123456
+noran_1|NesmaHatem|159753
+merret1|merret|123456
+salmaa1|laila|123456
\ No newline at end of file
diff --git a/NumberBoughtProduct.txt b/NumberBoughtProduct.txt
index ca7bf83..3f10ffe 100644
--- a/NumberBoughtProduct.txt
+++ b/NumberBoughtProduct.txt
@@ -1 +1 @@
-13
\ No newline at end of file
+15
\ No newline at end of file
diff --git a/NumberOfAddedUsersAccounts.txt b/NumberOfAddedUsersAccounts.txt
index 9d60796..bf0d87a 100644
--- a/NumberOfAddedUsersAccounts.txt
+++ b/NumberOfAddedUsersAccounts.txt
@@ -1 +1 @@
-11
\ No newline at end of file
+4
\ No newline at end of file
diff --git a/Products.txt b/Products.txt
index b836184..6808af3 100644
--- a/Products.txt
+++ b/Products.txt
@@ -4,6 +4,3 @@ laptop|electronices|200|offfer
Tshirt|clothes|200|no_offfer
tables|furniture|3000|offfer
Shampo|haircare|200|offfer
-Shampo|haircare|50|no_offer
-chocolate|food|20|no_offer
-mobile|electronices|6000|no_Offer
diff --git a/ProductsOfStoreowner.txt b/ProductsOfStoreowner.txt
index 967c901..116977b 100644
--- a/ProductsOfStoreowner.txt
+++ b/ProductsOfStoreowner.txt
@@ -1,10 +1,4 @@
-nada_hatem|Shampo|haircare|200|Pantene|haircare|5
-nada_hatem|Shampo|haircare|200|Loreal|haircare|4
-noraan_|Shampo|haircare|200|Clear|haircare|6
-salma2|laptop|electronices|200|hp|electronices|6
-salma2|chocolate|food|20|Moro|food|10
-nada_hatem|chocolate|food|20|Dairymilk|chocolate|10
-nada_hatem|laptop|electronices|200|lenovo|electronices|10
-nada_hatem|Shampo|haircare|50|Loreal|haircare|40
-nada_hatem|mobile|electronices|6000|hp|electronices|8
-nada_hatem|Shampo|haircare|200|Pantene|haircare|2
+Shampo|haircare|200|Pantene|haircare|5
+Shampo|haircare|200|Loreal|haircare|4
+Shampo|haircare|200|Clear|haircare|6
+laptop|electronices|200|hp|electronices|6
diff --git a/Store.txt b/Store.txt
index 6a9a8cc..b2c50eb 100644
--- a/Store.txt
+++ b/Store.txt
@@ -1,3 +1,3 @@
-laylaStore|nada_hatem|clothes|Dokki
-maha|nada_hatem|clothes|Haram
-sahar|alaa_el_lol|makeup|Dokki
+laylaStore|clothes|Dokki
+maha|clothes|Haram
+sahar|makeup|Dokki
diff --git a/StoreOwnerAccounts.txt b/StoreOwnerAccounts.txt
index 1d33fa3..a5d28e1 100644
--- a/StoreOwnerAccounts.txt
+++ b/StoreOwnerAccounts.txt
@@ -1,6 +1,3 @@
nada_hatem|123456789
alaa_el_lol|123456
nouran_mohamed|987654321
-youmnaMohamed|123654
-salma2|123456
-noraan_|123456
diff --git a/UserAccounts.txt b/UserAccounts.txt
index 01d425b..9672982 100644
--- a/UserAccounts.txt
+++ b/UserAccounts.txt
@@ -2,10 +2,3 @@ nesma_thabet|159753
youmna_ahmed|123456789
mno77|3451267
merette_nabil|753951
-noran_1|123456789
-lailaa_|145632
-merret1|123456789
-nesma12|456987123
-salmaa1|123456
-youssefMohamed|123456
-nesmaaThabit|159753
diff --git a/bin/.gitignore b/bin/.gitignore
index f612aff..1bce16b 100644
--- a/bin/.gitignore
+++ b/bin/.gitignore
@@ -1,7 +1,19 @@
+/Adminstrator.class
+/Brand.class
+/BrandEntity.class
+/BuyedProduct.class
+/BuyedProductEntity.class
+/Collaborator.class
+/FileUsage.class
+/Main.class
+/ProductEntity.class
+/ProductOfStoreowner.class
+/ProductOfStoreownerEntity.class
+/Store.class
+/StoreEntity.class
+/StoreOwner.class
+/User.class
+/UserEntity.class
+/product.class
/sprint3/
-/CheckAccountToBuyProduct.class
-/StoreownerBuyProduct.class
-/StoreOwnerAddColloborators.class
-/StoreOwnerAddProducts.class
-/StoreOwnerAddStores.class
-/StoreOwnerBuyProducts.class
+/systemUser.class
diff --git a/bin/Adminstrator.class b/bin/Adminstrator.class
deleted file mode 100644
index 598b616..0000000
Binary files a/bin/Adminstrator.class and /dev/null differ
diff --git a/bin/Brand.class b/bin/Brand.class
deleted file mode 100644
index 5d673d7..0000000
Binary files a/bin/Brand.class and /dev/null differ
diff --git a/bin/BrandEntity.class b/bin/BrandEntity.class
deleted file mode 100644
index c347266..0000000
Binary files a/bin/BrandEntity.class and /dev/null differ
diff --git a/bin/BuyedProduct.class b/bin/BuyedProduct.class
deleted file mode 100644
index 3436d43..0000000
Binary files a/bin/BuyedProduct.class and /dev/null differ
diff --git a/bin/BuyedProductEntity.class b/bin/BuyedProductEntity.class
deleted file mode 100644
index 9195659..0000000
Binary files a/bin/BuyedProductEntity.class and /dev/null differ
diff --git a/bin/Collaborator.class b/bin/Collaborator.class
deleted file mode 100644
index 3073cec..0000000
Binary files a/bin/Collaborator.class and /dev/null differ
diff --git a/bin/FileUsage.class b/bin/FileUsage.class
deleted file mode 100644
index 56d5104..0000000
Binary files a/bin/FileUsage.class and /dev/null differ
diff --git a/bin/Main.class b/bin/Main.class
deleted file mode 100644
index 9b0a08d..0000000
Binary files a/bin/Main.class and /dev/null differ
diff --git a/bin/ProductEntity.class b/bin/ProductEntity.class
deleted file mode 100644
index 374dda0..0000000
Binary files a/bin/ProductEntity.class and /dev/null differ
diff --git a/bin/ProductOfStoreowner.class b/bin/ProductOfStoreowner.class
deleted file mode 100644
index e499653..0000000
Binary files a/bin/ProductOfStoreowner.class and /dev/null differ
diff --git a/bin/ProductOfStoreownerEntity.class b/bin/ProductOfStoreownerEntity.class
deleted file mode 100644
index ee42c9f..0000000
Binary files a/bin/ProductOfStoreownerEntity.class and /dev/null differ
diff --git a/bin/Store.class b/bin/Store.class
deleted file mode 100644
index 35d018a..0000000
Binary files a/bin/Store.class and /dev/null differ
diff --git a/bin/StoreEntity.class b/bin/StoreEntity.class
deleted file mode 100644
index efbbfe5..0000000
Binary files a/bin/StoreEntity.class and /dev/null differ
diff --git a/bin/StoreOwner.class b/bin/StoreOwner.class
deleted file mode 100644
index 2ab5dd7..0000000
Binary files a/bin/StoreOwner.class and /dev/null differ
diff --git a/bin/User.class b/bin/User.class
deleted file mode 100644
index 2119f7f..0000000
Binary files a/bin/User.class and /dev/null differ
diff --git a/bin/UserEntity.class b/bin/UserEntity.class
deleted file mode 100644
index e6fd4c4..0000000
Binary files a/bin/UserEntity.class and /dev/null differ
diff --git a/bin/product.class b/bin/product.class
deleted file mode 100644
index 3de3bce..0000000
Binary files a/bin/product.class and /dev/null differ
diff --git a/bin/sprint4/NumberOfAddedAccounts.class b/bin/sprint4/NumberOfAddedAccounts.class
new file mode 100644
index 0000000..33d7833
Binary files /dev/null and b/bin/sprint4/NumberOfAddedAccounts.class differ
diff --git a/bin/sprint4/StatisticsStoreOwner.class b/bin/sprint4/StatisticsStoreOwner.class
new file mode 100644
index 0000000..bce10c2
Binary files /dev/null and b/bin/sprint4/StatisticsStoreOwner.class differ
diff --git a/bin/sprint4/UserWantsViewProduct.class b/bin/sprint4/UserWantsViewProduct.class
new file mode 100644
index 0000000..9f39606
Binary files /dev/null and b/bin/sprint4/UserWantsViewProduct.class differ
diff --git a/bin/sprint4/numberOfBoughtProducts.class b/bin/sprint4/numberOfBoughtProducts.class
new file mode 100644
index 0000000..8ee2a38
Binary files /dev/null and b/bin/sprint4/numberOfBoughtProducts.class differ
diff --git a/bin/systemUser.class b/bin/systemUser.class
deleted file mode 100644
index d7cc0c8..0000000
Binary files a/bin/systemUser.class and /dev/null differ
diff --git a/count.txt b/count.txt
index 368f89c..8fdd954 100644
--- a/count.txt
+++ b/count.txt
@@ -1 +1 @@
-28
\ No newline at end of file
+22
\ No newline at end of file
diff --git a/src/Adminstrator.java b/src/Adminstrator.java
index af3be14..abb48fa 100644
--- a/src/Adminstrator.java
+++ b/src/Adminstrator.java
@@ -4,96 +4,97 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
+public class Adminstrator extends systemUser {
+ public Adminstrator() throws Exception {
+ super();
+ }
-public class Adminstrator extends systemUser {
- public Adminstrator() throws Exception {
- super();
- }
-
- @SuppressWarnings("resource")
- public void addproducttosystem() throws Exception {
- Scanner userInput2 = new Scanner(System.in);
- System.out.println("name of products is:");
- String Pname = userInput2.nextLine();
- System.out.println("category of products is:");
- String Pcategory = userInput2.nextLine();
- System.out.println("price of products is:");
- String Pprice = userInput2.nextLine();
- System.out.println("offer on products is:");
- String Poffer = userInput2.nextLine();
- new product().addproductinfo(Pname, Pcategory, Pprice, Poffer);
- }
-
- boolean check = true;
-
- @SuppressWarnings("resource")
- public boolean AcceptStore() {
- System.out.println("Do you want to add this store to storeOwner enter 1 if no enter 2");
- Scanner request = new Scanner(System.in);
- int what = request.nextInt();
- if (what == 1) {
- return check;
- }
- check = false;
- return check;
- }
-
- @SuppressWarnings("resource")
- public void addBrandtosystem() throws Exception {
- Scanner userInput2 = new Scanner(System.in);
- System.out.println("name of Brands is:");
- String name = userInput2.nextLine();
- System.out.println("category of Brands is:");
- String category = userInput2.nextLine();
- new Brand().addBrandinfo(name, category);
- }
-
- @SuppressWarnings("resource")
- public void addnewstatistics() throws IOException {
-
- ArrayList numUsers = new ArrayList();
- BufferedReader reader1 = new BufferedReader(new FileReader(new File("UserAccounts.txt")));
- String line1;
- while ((line1 = reader1.readLine()) != null) {
- String[] arr = line1.split("\\|");
- numUsers.add(new UserEntity(arr[0], arr[1]));
- }
- int j;
- for (j = 0; j < numUsers.size(); ++j) {
- }
- System.out.println("Number of users register: " + j);
-
- ArrayList numStoreOwners = new ArrayList();
- BufferedReader reader2 = new BufferedReader(new FileReader(new File("StoreOwnerAccounts.txt")));
- String line2;
- while ((line2 = reader2.readLine()) != null) {
- String[] arr1 = line2.split("\\|");
- numStoreOwners.add(new UserEntity(arr1[0], arr1[1]));
- }
- int k;
- for (k = 0; k < numStoreOwners.size(); ++k) {
- }
- System.out.println("Number of storeOwners register: " + k);
-
- ArrayList products = new ArrayList();
- BufferedReader reader3 = new BufferedReader(new FileReader(new File("Products.txt")));
- String line3;
- while ((line3 = reader3.readLine()) != null) {
- String[] arr = line3.split("\\|");
- products.add(new ProductEntity(arr[0], arr[1], arr[2], arr[3]));
- }
- int i;
- for (i = 0; i < products.size(); ++i) {
- }
- System.out.println("Number of products: " + i);
- System.out.println("Products & Offers ]::::");
- BufferedReader br1 = new BufferedReader(new FileReader(new File("Products.txt")));
- String line4 = br1.readLine();
- while (line4 != null) {
- String[] arr = line4.split("\\|");
- System.out.println(arr[0] + " " + arr[3]);
- line4 = br1.readLine();
- }
- }
+ @SuppressWarnings("resource")
+public void addproducttosystem()throws Exception {
+ Scanner userInput2 = new Scanner(System.in);
+ System.out.println("name of products is:");
+ String Pname = userInput2.nextLine();
+ System.out.println("category of products is:" );
+ String Pcategory = userInput2.nextLine();
+ System.out.println("price of products is:" );
+ String Pprice = userInput2.nextLine();
+ System.out.println("offer on products is:");
+ String Poffer = userInput2.nextLine();
+ new product().addproductinfo(Pname,Pcategory, Pprice,Poffer);
+ }
+ boolean check=true;
+ @SuppressWarnings("resource")
+public boolean AcceptStore() {
+ System.out.println("Do you want to add this store to storeOwner enter 1 if no enter 2");
+ Scanner request=new Scanner(System.in);
+ int what=request.nextInt();
+ if(what==1) {
+ return check;
+ }
+ check=false;
+ return check;
+ }
+ @SuppressWarnings("resource")
+public void addBrandtosystem()throws Exception {
+ Scanner userInput2 = new Scanner(System.in);
+ System.out.println("name of Brands is:");
+ String name = userInput2.nextLine();
+ System.out.println("category of Brands is:" );
+ String category = userInput2.nextLine();
+ new Brand().addBrandinfo(name,category);
+ }
+
+
+ @SuppressWarnings("resource")
+public void addnewstatistics() throws IOException {
+
+ ArrayList numUsers = new ArrayList();
+ BufferedReader reader1 = new BufferedReader(new FileReader(new File("UserAccounts.txt")));
+ String line1;
+ while((line1 = reader1.readLine()) != null) {
+ String[] arr = line1.split("\\|");
+ numUsers.add(new UserEntity(arr[0], arr[1]));
+ }
+ int j;
+ for(j = 0; j < numUsers.size(); ++j) {
+ }
+ System.out.println("Number of users register: "+j);
+
+
+
+ ArrayList numStoreOwners = new ArrayList();
+ BufferedReader reader2 = new BufferedReader(new FileReader(new File("StoreOwnerAccounts.txt")));
+ String line2;
+ while((line2 = reader2.readLine()) != null) {
+ String[] arr1 = line2.split("\\|");
+ numStoreOwners.add(new UserEntity(arr1[0], arr1[1]));
+ }
+ int k;
+ for(k = 0; k < numStoreOwners.size(); ++k) {
+ }
+ System.out.println("Number of storeOwners register: "+k);
+
+
+
+ ArrayList products = new ArrayList();
+ BufferedReader reader3 = new BufferedReader(new FileReader(new File("Products.txt")));
+ String line3;
+ while((line3 = reader3.readLine()) != null) {
+ String[] arr = line3.split("\\|");
+ products.add(new ProductEntity(arr[0], arr[1], arr[2],arr[3]));
+ }
+ int i;
+ for(i = 0; i < products.size(); ++i) {
+ }
+ System.out.println("Number of products: "+i);
+ System.out.println(" Products & Offers :");
+ BufferedReader br1 = new BufferedReader(new FileReader(new File("Products.txt")));
+ String line4= br1.readLine();
+ while(line4 != null) {
+ String[] arr = line4.split("\\|");
+ System.out.println(arr[0]+" "+arr[3]);
+ line4=br1.readLine();
+ }
+ }
}
diff --git a/src/Brand.java b/src/Brand.java
index f2522bf..bdda3b8 100644
--- a/src/Brand.java
+++ b/src/Brand.java
@@ -1,7 +1,6 @@
import java.io.IOException;
import java.util.ArrayList;
public class Brand {
- product p=new product();
@SuppressWarnings("unused")
private
String bname;
diff --git a/src/BrandEntity.java b/src/BrandEntity.java
index d7b89d0..5bed0ae 100644
--- a/src/BrandEntity.java
+++ b/src/BrandEntity.java
@@ -1,27 +1,25 @@
-public class BrandEntity {
+public class BrandEntity {
private String category;
private String name;
-
public BrandEntity(String name, String category) {
this.name = name;
this.category = category;
-
+
}
-
+
public String getBrandName() {
return name;
}
-
public void setBrandName(String name) {
this.name = name;
}
-
public String getBrandCategory() {
return category;
}
-
public void setBrandCategory(String category) {
this.category = category;
}
-
+
+
+
}
diff --git a/src/BuyedProduct.java b/src/BuyedProduct.java
index 23fe15d..bd4f70c 100644
--- a/src/BuyedProduct.java
+++ b/src/BuyedProduct.java
@@ -2,151 +2,140 @@
import sprint3.numberOfBoughtProducts;
public class BuyedProduct {
- private String username;
- private String storeownername;
- private String productname;
- protected String amount;
- private String bname;
- private String pprice;
- private String shippingaddress;
- ArrayList BuyedProductDatabase = new ArrayList();
+private String username;
+private String productname;
+protected String amount;
+protected String bname;
+private String pprice;
+protected String shippingaddress;
- public BuyedProduct(String uname,String storeownername, String Pname, String bamount, String bname, String price, String address)
- throws Exception {
- this.username = uname;
- this.storeownername=storeownername;
- this.productname = Pname;
- this.amount = bamount;
- this.bname = bname;
- this.pprice = price;
- this.shippingaddress = address;
+ ArrayList BuyedProductDatabase = new ArrayList();
+
+public BuyedProduct(String uname,String Pname,String bamount,String bname,String price,String address) throws Exception {
+ this.username = uname;
+ this.productname=Pname;
+ this.amount=bamount;
+ this.bname=bname;
+ this.pprice=price;
+ this.shippingaddress=address;
+
+ BuyedProductDatabase=FileUsage.buyed_productReadFromFile(BuyedProductDatabase);
+}
+public BuyedProduct() throws Exception {
+
+ BuyedProductDatabase=FileUsage.buyed_productReadFromFile(BuyedProductDatabase);
+}
- BuyedProductDatabase = FileUsage.buyed_productReadFromFile(BuyedProductDatabase);
- }
-
- public BuyedProduct() throws Exception {
+public void buyproduct(String uname, String pname, String bamount,String bname,String pprice,String shippingaddress) throws Exception {
+ boolean FoundinSystem2=false;
+ boolean FoundinSystem3=false;
+ boolean FoundinSystem4 = false;
+ boolean FoundinSystem5 = false;
+ boolean Found = false;
+ Integer num1=0;
+ Integer num2=0;
- BuyedProductDatabase = FileUsage.buyed_productReadFromFile(BuyedProductDatabase);
- }
-
- public void buyproduct(String uname, String storeownername ,String pname, String bamount, String bname, String pprice,
- String shippingaddress) throws Exception {
- boolean FoundinSystem2 = false;
- boolean FoundinSystem3 = false;
- boolean FoundinSystem4 = false;
- boolean FoundinSystem5 = false;
- boolean Found = false;
- Integer num1 = 0;
- Integer num2 = 0;
- Integer num3 = 0;
- String remain;
- for (int i = 0; i < new ProductOfStoreowner().ProductOfStoreownerDatabase.size(); i++) {
- num1 = Integer.valueOf(bamount);
- num2 = Integer.valueOf(new ProductOfStoreowner().ProductOfStoreownerDatabase.get(i).getProductQuantity());
- // p.price=String.valueOf(new
- // ProductOfStoreowner().ProductOfStoreownerDatabase.get(i).getPrice());
- if (num1 <= num2) {
- FoundinSystem3 = true;
- }
+ for(int i=0;i storeReadFromFile(ArrayList st
String line;
while((line = reader.readLine()) != null) {
String[] arr = line.split("\\|");
- store.add(new StoreEntity(arr[0], arr[1], arr[2],arr[3]));
+ store.add(new StoreEntity(arr[0], arr[1], arr[2]));
}
return store;
}
@SuppressWarnings("resource")
public static ArrayList buyed_productReadFromFile(ArrayList buyedProduct) throws Exception{
- BufferedReader reader = new BufferedReader(new FileReader(new File("BuyedProduct.txt")));
- String line;
- while ((line = reader.readLine()) != null) {
- String[] arr = line.split("\\|");
- buyedProduct.add(new BuyedProductEntity(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5],arr[6]));
- }
- return buyedProduct;
- }
-
+ BufferedReader reader = new BufferedReader(new FileReader(new File("BuyedProduct.txt")));
+ String line;
+ while((line = reader.readLine()) != null) {
+ String[] arr = line.split("\\|");
+ buyedProduct.add(new BuyedProductEntity(arr[0], arr[1], arr[2], arr[3],arr[4],arr[5]));
+ }
+ return buyedProduct;
+ }
}
\ No newline at end of file
diff --git a/src/Main.java b/src/Main.java
index 4fea18f..967e717 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -4,131 +4,138 @@
public class Main {
- @SuppressWarnings({ "unused", "resource" })
- public static void main(String[] args) throws Exception {
- User u = new User();
- StoreOwner s = new StoreOwner();
- Adminstrator a = new Adminstrator();
- Collaborator c = new Collaborator();
- product p = new product();
- boolean storewant = false;
- Scanner userInput = new Scanner(System.in);
- while (true) {
- System.out.println("For register enter 1: ");
- System.out.println("For login enter 2: ");
- int want = userInput.nextInt();
- if (want == 1) {
- System.out.println("To return to home page Enter 0: ");
- System.out.println("For register as a new user enter 1: ");
- System.out.println("For register as a new store owner enter 2: ");
- System.out.println("For register as a new Adminstrator enter 3: ");
- int want1 = userInput.nextInt();
- if (want1 == 0) {
- System.out.println(" To Home Pgae ");
- }
- if (want1 == 1) {
- u.register(1);
- }
- if (want1 == 2) {
- s.register(2);
- }
- if (want1 == 3) {
- a.register(3);
- }
- } else if (want == 2) {
- System.out.println("To return to home page Enter 0: ");
- System.out.println("For login as a User enter 1: ");
- System.out.println("For login as a Store owner enter 2: ");
- System.out.println("For login as an Adminstrator enter 3: ");
- System.out.println("For login as a Collaborator enter 4: ");
- int want2 = userInput.nextInt();
- if (want2 == 0) {
- System.out.println(" To the Home Page ");
- }
- if (want2 == 1) {
- u.login(1);
- System.out.println("To return to home page Enter 0: ");
- System.out.println("To view products Enter 1: ");
- System.out.println("To buy a product Enter 2: ");
- int userwant = userInput.nextInt();
- if (userwant == 0) {
- System.out.println(" To the Home Page ");
- }
- if (userwant == 1) {
- new UserWantsViewProduct().wantstoviewproduct();
- }
- if (userwant == 2) {
- u.userbuyproduct();
- }
-
- } else if (want2 == 2) {
- s.login(2);
- if (storewant == true) {
- if (a.check == true) {
- System.out.println("Adminstrator accepts to add new store");
- s.addnewstore();
- } else if (a.check == false) {
- System.out.println("Adminstrator refuses to add new store");
- }
- }
-
- System.out.println("To return to home page Enter 0: ");
- System.out.println("To Add new store Enter 1: ");
- System.out.println("To Add new product to store Enter 2: ");
- System.out.println("To view statistics Enter 3: ");
- System.out.println("To Add new Collaborator Enter 4:");
- System.out.println("To buy a product Enter 5:");
- int want3 = userInput.nextInt();
- if (want3 == 0) {
- System.out.println(" To the Home Page ");
- }
- if (want3 == 1) {
- storewant = true;
- s.wantaddstore();
- }
- if (want3 == 2) {
- s.addproducttostoreowner();
- }
- if (want3 == 3) {
- new StatisticsStoreOwner().usersstatistics();
- }
- if (want3 == 4) {
- s.wantToAddCollaborator();
- }
- if (want3 == 5) {
- s.storeownerbuyproduct();
- }
-
- } else if (want2 == 3) {
- a.login(3);
- if (storewant) {
- a.AcceptStore();
- }
- System.out.println("To return to home page Enter 0: ");
- System.out.println("To Add new product Enter 1: ");
- System.out.println("To Add new brand Enter 2: ");
- System.out.println("To see new statistics Enter 3:");
- int want4 = userInput.nextInt();
- if (want4 == 0) {
- System.out.println(" To the Home Page ");
- }
- if (want4 == 1) {
- a.addproducttosystem();
- }
- if (want4 == 2) {
- a.addBrandtosystem();
-
- }
- if (want4 == 3) {
- a.addnewstatistics();
- }
-
- } else if (want2 == 4) {
- c.CollaboratoerLogin();
- c.useAsStoreOwner();
-
- }
- }
+ @SuppressWarnings({ "unused", "resource" })
+ public static void main(String[] args) throws Exception{
+ User u=new User();
+ StoreOwner s=new StoreOwner();
+ Adminstrator a=new Adminstrator();
+ Collaborator c= new Collaborator();
+ product p = new product();
+ boolean storewant=false;
+ Scanner userInput = new Scanner(System.in);
+ while(true) {
+ System.out.println("For register enter 1: ");
+ System.out.println("For login enter 2: ");
+ int want=userInput.nextInt();
+ if (want==1){
+ System.out.println("To return to home page Enter 0: ");
+ System.out.println("For register as a new user enter 1: ");
+ System.out.println("For register as a new store owner enter 2: ");
+ System.out.println("For register as a new Adminstrator enter 3: ");
+ int want1=userInput.nextInt();
+ if(want1==0) {
+ System.out.println(" To Home Pgae ");
+ }
+ if(want1==1){
+ u.register(1);
+ }
+ if(want1==2){
+ s.register(2);
+ }
+ if(want1==3){
+ a.register(3);
+ }
+ }
+ else if(want==2)
+ {
+ System.out.println("To return to home page Enter 0: ");
+ System.out.println("For login as a User enter 1: ");
+ System.out.println("For login as a Store owner enter 2: ");
+ System.out.println("For login as an Adminstrator enter 3: ");
+ System.out.println("For login as a Collaborator enter 4: ");
+ int want2=userInput.nextInt();
+ if(want2==0) {
+ System.out.println(" To the Home Page ");
+ }
+ if(want2==1){
+ u.login(1);
+ System.out.println("To return to home page Enter 0: ");
+ System.out.println("To view products Enter 1: ");
+ System.out.println("To buy a product Enter 2: ");
+ int userwant=userInput.nextInt();
+ if(userwant==0) {
+ System.out.println(" To the Home Page ");
+ }
+ if(userwant==1) {
+ new UserWantsViewProduct().wantstoviewproduct();
+ }
+ if(userwant==2) {
+ u.userbuyproduct();
+ }
+
+ }
+ else if(want2==2){
+ s.login(2);
+ if(storewant==true) {
+ if(a.check==true) {
+ System.out.println("Adminstrator accepts to add new store");
+ s.addnewstore();
+ }
+ else if(a.check==false) {
+ System.out.println("Adminstrator refuses to add new store");
+ }
+ }
+
+ System.out.println("To return to home page Enter 0: ");
+ System.out.println("To Add new store Enter 1: ");
+ System.out.println("To Add new product to store Enter 2: ");
+ System.out.println("To view statistics Enter 3: ");
+ System.out.println("To buy a product Enter 4: ");
+ System.out.println("To Add new Collaborator Enter 5:");
+ int want3=userInput.nextInt();
+ if(want3==0) {
+ System.out.println(" To the Home Page ");
+ }
+ if(want3==1) {
+ storewant=true;
+ s.wantaddstore();
+ }
+ if(want3==2) {
+ s.addproducttostoreowner();
+ }
+ if(want3==3) {
+ new StatisticsStoreOwner().usersstatistics();
+ }
+ if(want3==4) {
+ s.storeownerbuyproduct();
+ }
+ if(want3==5) {
+ s.wantToAddCollaborator();
+ }
+
+ }
+ else if(want2==3){
+ a.login(3);
+ if(storewant) {
+ a.AcceptStore();
+ }
+ System.out.println("To return to home page Enter 0: ");
+ System.out.println("To Add new product Enter 1: ");
+ System.out.println("To Add new brand Enter 2: ");
+ System.out.println("To see new statistics Enter 3:");
+ int want4=userInput.nextInt();
+ if(want4==0) {
+ System.out.println(" To the Home Page ");
+ }
+ if(want4==1) {
+ a.addproducttosystem();
+ }
+ if(want4==2) {
+ a.addBrandtosystem();
+
+ }
+ if(want4==3) {
+ a.addnewstatistics();
+ }
+
+
+
+ }
+ else if(want2==4){
+ c.CollaboratoerLogin();
+ c.useAsStoreOwner();
+ }
+ }
+ }
}
- }
-}
\ No newline at end of file
+}
diff --git a/src/ProductOfStoreowner.java b/src/ProductOfStoreowner.java
index b8eafa8..901f50a 100644
--- a/src/ProductOfStoreowner.java
+++ b/src/ProductOfStoreowner.java
@@ -1,72 +1,69 @@
import java.util.ArrayList;
-
@SuppressWarnings("unused")
public class ProductOfStoreowner {
- private String storeOwnerName;
- private String name;
- private String category;
- private String price;
- private String productquantity;
- private String brandname;
- private String brandcategory;
-
- ArrayList ProductOfStoreownerDatabase = new ArrayList();
-
- public ProductOfStoreowner(String storeOwnerName, String Pname, String Pcategory, String Pprice, String bname,
- String bcategory, String productquantity) throws Exception {
+private String storeOwnerName;
+private String name;
+private String category;
+private String price;
+private String productquantity;
+private String brandname;
+private String brandcategory;
- this.storeOwnerName = storeOwnerName;
- this.name = Pname;
- this.category = Pcategory;
- this.price = Pprice;
- this.productquantity = productquantity;
- this.brandname = bname;
- this.brandcategory = bcategory;
-
- ProductOfStoreownerDatabase = FileUsage.product_sOwnerReadFromFile(ProductOfStoreownerDatabase);
- }
+ ArrayList ProductOfStoreownerDatabase = new ArrayList();
+
+public ProductOfStoreowner(String storeOwnerName,String Pname,String Pcategory,String Pprice,String bname,String bcategory, String productquantity) throws Exception {
+
+ this.storeOwnerName=storeOwnerName;
+ this.name=Pname;
+ this.category=Pcategory;
+ this.price=Pprice;
+ this.productquantity=productquantity;
+ this.brandname=bname;
+ this.brandcategory=bcategory;
+
+ ProductOfStoreownerDatabase = FileUsage.product_sOwnerReadFromFile(ProductOfStoreownerDatabase);
+}
+public ProductOfStoreowner() throws Exception {
+
+ ProductOfStoreownerDatabase = FileUsage.product_sOwnerReadFromFile(ProductOfStoreownerDatabase);
+}
- public ProductOfStoreowner() throws Exception {
- ProductOfStoreownerDatabase = FileUsage.product_sOwnerReadFromFile(ProductOfStoreownerDatabase);
+public void addstoreproductinfo( String storeOwnerName,String pname, String pcategory,String pprice,String bname,String bcategory,String pproductquantity) throws Exception {
+
+ boolean FoundinSystem1=false;
+ boolean FoundinSystem2=false;
+ for(int i = 0; i < new product().prodctDatabase.size() ; ++i) {
+ if((pname.equals(new product().prodctDatabase.get(i).getName())) &&
+ (pcategory.equals(new product().prodctDatabase.get(i).getCategory())) &&
+ (pprice.equals(new product().prodctDatabase.get(i).getPrice())))
+ {
+ FoundinSystem1=true;
+
+ }
}
-
- public void addstoreproductinfo(String storeOwnerName, String pname, String pcategory, String pprice, String bname,
- String bcategory, String pproductquantity) throws Exception {
-
- boolean FoundinSystem1 = false;
- boolean FoundinSystem2 = false;
- for (int i = 0; i < new product().prodctDatabase.size(); ++i) {
- if ((pname.equals(new product().prodctDatabase.get(i).getName()))
- && (pcategory.equals(new product().prodctDatabase.get(i).getCategory()))
- && (pprice.equals(new product().prodctDatabase.get(i).getPrice()))) {
- FoundinSystem1 = true;
-
- }
- }
- for (int j = 0; j < new Brand().BrandDatabase.size(); j++) {
- if ((bname.equals(new Brand().BrandDatabase.get(j).getBrandName()))
- && (bcategory.equals(new Brand().BrandDatabase.get(j).getBrandCategory()))) {
- FoundinSystem2 = true;
-
- }
- }
- if (FoundinSystem1 == false || FoundinSystem2 == false) {
- System.out.println("The Product or Brand is not found in system");
- return;
- }
- if (FoundinSystem1 == true & FoundinSystem2 == true) {
- for (int i = 0; i < ProductOfStoreownerDatabase.size(); ++i) {
- if (ProductOfStoreownerDatabase.get(i).getName().equals(pname)
- & ProductOfStoreownerDatabase.get(i).getBrandName().equals(bname) & bcategory == pcategory) {
- System.out.print("this product is already added with this brand \n");
- return;
- }
- }
- FileUsage.usingBufferedWritter(storeOwnerName + "|" + pname + "|" + pcategory + "|" + pprice + "|" + bname
- + "|" + bcategory + "|" + pproductquantity, "ProductsOfStoreowner.txt");
- System.out.println("Product is added to store with a brand");
- }
+ for(int j = 0; j < new Brand().BrandDatabase.size() ; j++) {
+ if((bname.equals(new Brand().BrandDatabase.get(j).getBrandName())) &&
+ (bcategory.equals(new Brand().BrandDatabase.get(j).getBrandCategory())))
+ {
+ FoundinSystem2=true;
+
+ }
}
+ if(FoundinSystem1==false || FoundinSystem2==false ) {
+ System.out.println("The Product or Brand is not found in system");
+ return;
+ }
+ if(FoundinSystem1==true & FoundinSystem2==true) {
+ for(int i = 0; i < ProductOfStoreownerDatabase.size() ; ++i) {
+ if(ProductOfStoreownerDatabase.get(i).getName().equals(pname) & ProductOfStoreownerDatabase.get(i).getBrandName().equals(bname) & bcategory==pcategory) {
+ System.out.print("this product is already added with this brand \n");
+ return;
+ }
+ }
+ FileUsage.usingBufferedWritter(storeOwnerName + "|" +pname + "|" + pcategory + "|" + pprice + "|" + bname + "|" + bcategory + "|" + pproductquantity,"ProductsOfStoreowner.txt");
+ System.out.println("Product is added to store with a brand");
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Store.java b/src/Store.java
index 6581d5f..3aaacb6 100644
--- a/src/Store.java
+++ b/src/Store.java
@@ -1,50 +1,34 @@
import java.io.IOException;
import java.util.ArrayList;
-
public class Store {
+
+
+ public String storelocation;
+ public String storetype;
+ public String storename;
+
+ ArrayList StoreDatabase=new ArrayList();
+ public Store(String storename ,String storetype, String storelocation) throws Exception {
+ this.storename=storename;
+ this.storetype=storetype;
+ this.storelocation=storelocation;
+
+ StoreDatabase=FileUsage.storeReadFromFile(StoreDatabase);
+ }
+ public Store() throws Exception{
+ StoreDatabase=FileUsage.storeReadFromFile(StoreDatabase);
+ }
- public String storelocation;
- public String storetype;
- public String storename;
- public String storeowneraccount;
- ArrayList StoreDatabase = new ArrayList();
-
- public Store(String storename, String storeowneraccount, String storetype, String storelocation) throws Exception {
- this.storename = storename;
- this.storeowneraccount = storeowneraccount;
- this.storetype = storetype;
- this.storelocation = storelocation;
-
- StoreDatabase = FileUsage.storeReadFromFile(StoreDatabase);
- }
-
- public Store() throws Exception {
- StoreDatabase = FileUsage.storeReadFromFile(StoreDatabase);
- }
-
- public void addstoreinfo(String storename, String storeowneraccount, String storetype, String storelocation)
- throws Exception {
- boolean FoundinSystem1 = false;
- boolean FoundinSystem2 = false;
- for (int i = 0; i < new systemUser().StoreODatabase.size(); ++i) {
- if (storeowneraccount.equals(new systemUser().StoreODatabase.get(i).getUsername())) {
- FoundinSystem1 = true;
- }
- }
- for (int i = 0; i < StoreDatabase.size(); ++i) {
- if (StoreDatabase.get(i).getname().equals(storename)) {
- System.out.print("this store is already found ");
- FoundinSystem2 = true;
- return;
- }
- }
- if (FoundinSystem1 == false) {
- System.out.println("This storeowner is not found");
- }
- if (FoundinSystem2 == false && FoundinSystem1 == true) {
- FileUsage.usingBufferedWritter(storename + "|" + storeowneraccount + "|" + storetype + "|" + storelocation,
- "Store.txt");
- System.out.println("Store is added");
- }
- }
+ public void addstoreinfo( String storename, String storetype,String storelocation) throws IOException {
+ for(int i = 0; i < StoreDatabase.size(); ++i) {
+ if(StoreDatabase.get(i).getname().equals(storename)) {
+ System.out.print("this product is found");
+ return;
+ }
+ }
+
+ FileUsage.usingBufferedWritter(storename + "|" + storetype + "|" + storelocation ,"Store.txt");
+ System.out.println("Store is added");
+}
}
+
diff --git a/src/StoreEntity.java b/src/StoreEntity.java
index 10842e0..10cc387 100644
--- a/src/StoreEntity.java
+++ b/src/StoreEntity.java
@@ -1,27 +1,19 @@
-public class StoreEntity {
- public StoreEntity(String name,String account, String type , String location) {
+public class StoreEntity {
+ public StoreEntity(String name, String type , String location) {
this.location = location;
this.type = type;
this.name = name;
- this.accountname=account;
}
private String location;
private String type;
private String name;
- private String accountname;
public String getname() {
return name;
}
public void setname(String name) {
this.name = name;
}
- public String getAccountname() {
- return accountname;
- }
- public void setAccountname(String accountname) {
- this.accountname = accountname;
- }
public String getType() {
return type;
}
diff --git a/src/StoreOwner.java b/src/StoreOwner.java
index 2f436ae..fabd331 100644
--- a/src/StoreOwner.java
+++ b/src/StoreOwner.java
@@ -1,95 +1,101 @@
import java.util.Scanner;
-public class StoreOwner extends systemUser implements StoreOwnerAddColloborators ,StoreOwnerAddProducts,StoreOwnerAddStores,StoreOwnerBuyProducts {
+public class StoreOwner extends systemUser implements StoreOwnerAddStores,StoreOwnerAddProducts,StoreOwnerBuyProducts,StoreOwnerAddColloborators {
systemUser s = new systemUser();
-
public StoreOwner() throws Exception {
super();
// TODO Auto-generated constructor stub
}
-
- @SuppressWarnings({ "resource", "unused" })
- public void wantaddstore() throws Exception {
-
- Scanner userInput2 = new Scanner(System.in);
- System.out.println("Name of store is:");
- String sname = userInput2.nextLine();
- System.out.println("Type of store is:" );
- String stype = userInput2.nextLine();
- System.out.println("location of store is:" );
- String slocation = userInput2.nextLine();
- System.out.println("Wait for the admin to accept this may take time");
+
+@SuppressWarnings({ "resource", "unused" })
+public void wantaddstore() throws Exception {
+ //Adminstrator admin=new Adminstrator();
+ Scanner userInput2 = new Scanner(System.in);
+ System.out.println("Name of store is:");
+ String sname = userInput2.nextLine();
+ System.out.println("Type of store is:");
+ String stype = userInput2.nextLine();
+ System.out.println("location of store is:");
+ String slocation = userInput2.nextLine();
+ System.out.println("Wait for the admin to accept this may take time");
}
- @SuppressWarnings({ "resource" })
public void addnewstore() throws Exception {
- Scanner userInput2 = new Scanner(System.in);
- System.out.println("Name of store is:");
- String sname = userInput2.nextLine();
- System.out.println("Your account name is:");
- String saccount = userInput2.nextLine();
- System.out.println("Type of store is:");
- String stype = userInput2.nextLine();
- System.out.println("location of store is:");
- String slocation = userInput2.nextLine();
- new Store().addstoreinfo(sname, saccount, stype, slocation);
+ Scanner userInput2 = new Scanner(System.in);
+ System.out.println("Name of store is:");
+ String sname = userInput2.nextLine();
+ System.out.println("Type of store is:");
+ String stype = userInput2.nextLine();
+ System.out.println("location of store is:");
+ String slocation = userInput2.nextLine();
+ new Store().addstoreinfo(sname, stype, slocation);
}
- @SuppressWarnings({ "resource" })
public void addproducttostoreowner() throws Exception {
- Scanner userInput3 = new Scanner(System.in);
-
- System.out.println("Name of Store owner is:");
- String storeOwnerName = userInput3.nextLine();
- System.out.println("Name of products is:");
- String Pname = userInput3.nextLine();
- System.out.println("Category of products is:");
- String Pcategory = userInput3.nextLine();
- System.out.println("Price of products is:");
- String Pprice = userInput3.nextLine();
- System.out.println("Name of brand is:");
- String Brandname = userInput3.nextLine();
- System.out.println("Category of brand is:");
- String Brandcategory = userInput3.nextLine();
- System.out.println("Quantity of products is:");
- String Pproductquantity = userInput3.nextLine();
- new ProductOfStoreowner().addstoreproductinfo(storeOwnerName, Pname, Pcategory, Pprice, Brandname,
- Brandcategory, Pproductquantity);
+ Scanner userInput3 = new Scanner(System.in);
+ System.out.println("name of Storeowner is:");
+ String StoreOwnerName = userInput3.nextLine();
+ System.out.println("name of products is:");
+ String Pname = userInput3.nextLine();
+ System.out.println("category of products is:");
+ String Pcategory = userInput3.nextLine();
+ System.out.println("price of products is:");
+ String Pprice = userInput3.nextLine();
+ System.out.println("name of brand is:");
+ String Brandname = userInput3.nextLine();
+ System.out.println("category of brand is:");
+ String Brandcategory = userInput3.nextLine();
+ System.out.println("Quantity of products is:");
+ String Pproductquantity = userInput3.nextLine();
+ new ProductOfStoreowner().addstoreproductinfo(StoreOwnerName,Pname, Pcategory, Pprice, Brandname, Brandcategory,
+ Pproductquantity);
}
+ public void storeownerbuyproduct() throws Exception {
+ Scanner userInput3 = new Scanner(System.in);
+ System.out.println("Account name is:");
+ String Uname = userInput3.nextLine();
+ System.out.println("name of products is:");
+ String Pname = userInput3.nextLine();
+ System.out.println("amount of products is:");
+ String bamount = userInput3.nextLine();
+ System.out.println("name of brand is:");
+ String bname = userInput3.nextLine();
+ System.out.println("price of product is:");
+ String pprice = userInput3.nextLine();
+ System.out.println("Shipping address is:");
+ String shippingaddress = userInput3.nextLine();
+ new BuyedProduct().buyproduct(Uname,Pname, bamount, bname,pprice,shippingaddress);
+
+ }
public void wantToAddCollaborator() throws Exception {
Scanner input = new Scanner(System.in);
- System.out.println("What is your Username? ");
- System.out.println("StoreOwner username: ");
- String storeOwnerName = input.nextLine();
System.out.println("Enter the information of your Collaborator ");
System.out.println("UserName: ");
- String collaboratorName = input.nextLine();
+ String collaboratorName=input.nextLine();
System.out.println("Password: ");
- String password = input.nextLine();
+ String password=input.nextLine();
System.out.println("Your Collaborator account is added succesfully!");
- FileUsage.usingBufferedWritter(storeOwnerName + "|" + collaboratorName, "storeOwnerCollaborator.txt");
- FileUsage.usingBufferedWritter(storeOwnerName + "|" + collaboratorName + "|" + password, "Collaborator.txt");
+ FileUsage.usingBufferedWritter(collaboratorName + "|" + password , "Collaborator.txt");
}
- public void storeownerbuyproduct() throws Exception {
- Scanner userInput3 = new Scanner(System.in);
- System.out.println("Your username is:");
- String Uname = userInput3.nextLine();
- System.out.println("Store owner account's name is:");
- String Sname = userInput3.nextLine();
- System.out.println("name of product is:");
- String Pname = userInput3.nextLine();
- System.out.println("amount of products is:");
- String bamount = userInput3.nextLine();
- System.out.println("name of brand is:");
- String bname = userInput3.nextLine();
- System.out.println("price of product is:");
- String pprice = userInput3.nextLine();
- System.out.println("Shipping address is:");
- String shippingaddress = userInput3.nextLine();
- new BuyedProduct().buyproduct(Uname, Sname, Pname, bamount, bname, pprice, shippingaddress);
-
- }
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/StoreOwnerAddColloborators.java b/src/StoreOwnerAddColloborators.java
index 93e1620..6054a19 100644
--- a/src/StoreOwnerAddColloborators.java
+++ b/src/StoreOwnerAddColloborators.java
@@ -1,3 +1,4 @@
+
public interface StoreOwnerAddColloborators {
public void wantToAddCollaborator() throws Exception;
}
diff --git a/src/StoreOwnerAddProducts.java b/src/StoreOwnerAddProducts.java
index 15b1ffd..f1f9db9 100644
--- a/src/StoreOwnerAddProducts.java
+++ b/src/StoreOwnerAddProducts.java
@@ -1,3 +1,4 @@
+
public interface StoreOwnerAddProducts {
public void addproducttostoreowner() throws Exception;
}
diff --git a/src/StoreOwnerAddStores.java b/src/StoreOwnerAddStores.java
index 895bd60..3ecddb4 100644
--- a/src/StoreOwnerAddStores.java
+++ b/src/StoreOwnerAddStores.java
@@ -1,5 +1,5 @@
+
public interface StoreOwnerAddStores {
public void wantaddstore() throws Exception;
-
public void addnewstore() throws Exception;
}
diff --git a/src/StoreOwnerBuyProducts.java b/src/StoreOwnerBuyProducts.java
index 8842394..3c862b6 100644
--- a/src/StoreOwnerBuyProducts.java
+++ b/src/StoreOwnerBuyProducts.java
@@ -1,3 +1,4 @@
+
public interface StoreOwnerBuyProducts {
public void storeownerbuyproduct() throws Exception;
}
diff --git a/src/User.java b/src/User.java
index bb5d1c5..c2c4121 100644
--- a/src/User.java
+++ b/src/User.java
@@ -9,11 +9,9 @@ public User() throws Exception {
@SuppressWarnings("resource")
public void userbuyproduct() throws Exception{
Scanner userInput3 = new Scanner(System.in);
- System.out.println("Your username is:");
+ System.out.println("Account name is:");
String Uname = userInput3.nextLine();
- System.out.println("Store owner account's name is:");
- String Sname = userInput3.nextLine();
- System.out.println("name of product is:");
+ System.out.println("name of products is:");
String Pname = userInput3.nextLine();
System.out.println("amount of products is:" );
String bamount = userInput3.nextLine();
@@ -23,7 +21,10 @@ public void userbuyproduct() throws Exception{
String pprice = userInput3.nextLine();
System.out.println("Shipping address is:" );
String shippingaddress = userInput3.nextLine();
- new BuyedProduct().buyproduct(Uname,Sname,Pname, bamount, bname, pprice,shippingaddress);
+ new BuyedProduct().buyproduct(Uname,Pname, bamount, bname, pprice,shippingaddress);
}
+
+
+ }
+
-}
\ No newline at end of file
diff --git a/src/product.java b/src/product.java
index 2228ca7..1c57fea 100644
--- a/src/product.java
+++ b/src/product.java
@@ -1,39 +1,37 @@
import java.io.IOException;
import java.util.ArrayList;
-public class product {
- protected String name;
- String category;
- String price;
- String offer;
-
- ArrayList prodctDatabase = new ArrayList();
-
- public product(String Pname, String Pcategory, String Pprice, String Poffer) throws Exception {
- this.name = Pname;
- this.category = Pcategory;
- this.price = Pprice;
- this.offer = Poffer;
-
- prodctDatabase = FileUsage.productReadFromFile(prodctDatabase);
- }
-
- public product() throws Exception {
- prodctDatabase = FileUsage.productReadFromFile(prodctDatabase);
- }
-
- int id = 0;
-
- public void addproductinfo(String pname, String pcategory, String pprice, String poffer) throws IOException {
- for (int i = 0; i < prodctDatabase.size(); ++i) {
- if (prodctDatabase.get(i).getName().equals(pname)) {
- System.out.print("this product is found \n");
- return;
- }
-
- }
-
- FileUsage.usingBufferedWritter(pname + "|" + pcategory + "|" + pprice + "|" + poffer, "Products.txt");
- System.out.println("Product is added to system");
- }
+public class product {
+protected
+ String name;
+ String category;
+ String price;
+ String offer;
+ ArrayList prodctDatabase = new ArrayList();
+
+ public product(String Pname,String Pcategory,String Pprice,String Poffer) throws Exception {
+ this.name=Pname;
+ this.category=Pcategory;
+ this.price=Pprice;
+ this.offer=Poffer;
+
+ prodctDatabase = FileUsage.productReadFromFile(prodctDatabase);
+ }
+ public product() throws Exception {
+ prodctDatabase = FileUsage.productReadFromFile(prodctDatabase);
+ }
+
+ int id=0;
+ public void addproductinfo( String pname, String pcategory,String pprice, String poffer) throws IOException {
+ for(int i = 0; i < prodctDatabase.size(); ++i) {
+ if(prodctDatabase.get(i).getName().equals(pname)) {
+ System.out.print("this product is found");
+ return;
+ }
+
+ }
+
+ FileUsage.usingBufferedWritter(pname + "|" + pcategory + "|" + pprice + "|" + poffer,"Products.txt");
+ System.out.println("Product is added to system");
+}
}
diff --git a/src/sprint4/NumberOfAddedAccounts.java b/src/sprint4/NumberOfAddedAccounts.java
index 722190d..e61ff03 100644
--- a/src/sprint4/NumberOfAddedAccounts.java
+++ b/src/sprint4/NumberOfAddedAccounts.java
@@ -1,4 +1,4 @@
-package sprint3;
+package sprint4;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
diff --git a/src/sprint4/StatisticsStoreOwner.java b/src/sprint4/StatisticsStoreOwner.java
index b996ec7..85062a8 100644
--- a/src/sprint4/StatisticsStoreOwner.java
+++ b/src/sprint4/StatisticsStoreOwner.java
@@ -1,4 +1,4 @@
-package sprint3;
+package sprint4;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
diff --git a/src/sprint4/UserWantsViewProduct.java b/src/sprint4/UserWantsViewProduct.java
index 56214e6..bd81ee0 100644
--- a/src/sprint4/UserWantsViewProduct.java
+++ b/src/sprint4/UserWantsViewProduct.java
@@ -1,4 +1,4 @@
-package sprint3;
+package sprint4;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
diff --git a/src/sprint4/numberOfBoughtProducts.java b/src/sprint4/numberOfBoughtProducts.java
index 9d28ea6..7523780 100644
--- a/src/sprint4/numberOfBoughtProducts.java
+++ b/src/sprint4/numberOfBoughtProducts.java
@@ -1,4 +1,4 @@
-package sprint3;
+package sprint4;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
diff --git a/storeOwnerCollaborator.txt b/storeOwnerCollaborator.txt
index 9b3dab5..f548168 100644
--- a/storeOwnerCollaborator.txt
+++ b/storeOwnerCollaborator.txt
@@ -1,7 +1,4 @@
nesma_thabet|noran
-
noran_1|NesmaHatem
-
merret1|merret
-
salmaa1|laila
\ No newline at end of file