Skip to content

Commit 05393ff

Browse files
committed
E-commerce site functionalities added
1 parent 2313475 commit 05393ff

File tree

7 files changed

+150
-1
lines changed

7 files changed

+150
-1
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import java.util.Scanner;
2+
3+
public class AdminControlPanel {
4+
public static void AdminControls(String adminId, String password) {
5+
if(!adminId.equals("admin") && !password.equals("password")){
6+
System.out.println("Wrong Credentials!");
7+
return;
8+
}
9+
boolean isAdminWantedToContinue = true;
10+
while (isAdminWantedToContinue){
11+
System.out.println("1 -> Products\n2 -> Customers\n3 -> Coupon Codes\n4 -> Back To Home\nEnterChoice");
12+
Scanner adminInput = new Scanner(System.in);
13+
int adminChoice = adminInput.nextInt();
14+
switch (adminChoice){
15+
case 1:
16+
Product.ProductsControlPanel();
17+
break;
18+
case 2:
19+
Customer.CustomerControlPanel();
20+
break;
21+
case 3:
22+
CouponCodes.CouponCodesControlPanel();
23+
break;
24+
case 4:
25+
break;
26+
}
27+
}
28+
}
29+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public class CouponCodes {
2+
public static void CouponCodesControlPanel() {
3+
}
4+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.ArrayList;
2+
import java.util.HashMap;
3+
import java.util.List;
4+
import java.util.Map;
5+
6+
public class Customer {
7+
static int id=1;
8+
int Customer_id;
9+
String Customer_name;
10+
String Customer_Contact;
11+
static Map<Integer, Customer> allCustomers = new HashMap<>();
12+
List<Product> CartItems;
13+
List<Invoice> CustomerInvoices;
14+
15+
public Customer(String customerName,String customerContact) {
16+
this.Customer_id = id++;
17+
this.Customer_name = customerName;
18+
this.Customer_Contact = customerContact;
19+
this.CartItems = new ArrayList<>();
20+
this.CustomerInvoices = new ArrayList<>();
21+
}
22+
23+
public static void CustomerControlPanel() {
24+
}
25+
26+
public static void CreateNewCustomer(String customerName,String customerContact) {
27+
Customer newCustomer = new Customer(customerName, customerContact);
28+
allCustomers.put(newCustomer.Customer_id, newCustomer);
29+
}
30+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
public class Invoice {
2+
}

EcommerceApplication/src/Main.java

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,72 @@
1+
import java.util.Scanner;
2+
3+
/*
4+
* E-Commerce Applications
5+
1 -> Admin
6+
2 -> Client
7+
3 -> Create New User
8+
9+
* Entire Client List -> List
10+
* Entire Purchase List -> List
11+
* Entire Product List -> Map
12+
* Entire Customer Purchase List -> Map
13+
14+
* Admin
15+
-> Add Product
16+
-> Can view/Add/Delete/Update Customers List
17+
-> Can view/Add/Delete/Update Products List
18+
-> Can view/Add/Delete/Update Coupon Codes
19+
-> Can view All Sales
20+
* Product Registration
21+
-> Product Id
22+
-> Product Name
23+
-> Product Stock
24+
25+
* Client
26+
-> Can View/AddToCart/Buy a Product
27+
-> Can View Invoice
28+
-> Delete Product while checkout
29+
30+
* New Client Registration
31+
-> Client Name
32+
-> Client User ID
33+
-> Admin Password To Verifications
34+
35+
*
36+
*/
137
public class Main {
238
public static void main(String[] args) {
3-
System.out.println("Hello world!");
39+
System.out.println("=================================" +
40+
"\n======E-Commerce Application=====" +
41+
"\n=================================");
42+
Scanner input =new Scanner(System.in);
43+
boolean isUserWantedToContinue = true;
44+
while (isUserWantedToContinue){
45+
System.out.println("1 -> Admin LogIn\n2 -> Customer LogIn\n3 -> Create New User\n4 -> Exit\nEnter Choice:");
46+
int userChoice = input.nextInt();
47+
switch (userChoice){
48+
case 1:
49+
System.out.println("Enter AdminId and Password");
50+
String AdminId = input.nextLine();
51+
String Password = input.nextLine();
52+
AdminControlPanel.AdminControls(AdminId,Password);
53+
break;
54+
case 2:
55+
System.out.println("Enter Customer Id:");
56+
int CustomerId = input.nextInt();
57+
ProductListPage.CustomerControls();
58+
break;
59+
case 3:
60+
System.out.println("Enter Customer Name and Customer Contact");
61+
String CustomerName = input.next();
62+
String CustomerContact = input.next();
63+
Customer.CreateNewCustomer(CustomerName, CustomerContact);
64+
65+
break;
66+
case 4:
67+
isUserWantedToContinue = false;
68+
break;
69+
};
70+
}
471
}
572
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import java.util.ArrayList;
2+
import java.util.List;
3+
4+
public class Product {
5+
static List<Product> allProducts = new ArrayList<>();
6+
static int id = 1;
7+
int productId;
8+
String productName;
9+
int productCount;
10+
11+
public static void ProductsControlPanel() {
12+
}
13+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public class ProductListPage {
2+
public static void CustomerControls() {
3+
}
4+
}

0 commit comments

Comments
 (0)