Challenge

Project 1

package project2;

import java.util.Scanner;

import java.util.regex.Pattern;

import java.util.ArrayList;

import java.util.List;

import java.lang.reflect.Array;

public class Project_2 {

static Scanner sc = new Scanner(System.in);

public static void main(String[] args) {

System.out.println("_________________*********_WELCOM TO E-COMMERCE CONSOL_*********_________________");

System.out.println("1. admin 2. Seller 3. User 4. New Customer");

System.out.println("Enter your choice of Number");

int n = sc.nextInt();

switch (n)

{

case 1: {

System.out.println("Wecome to admine page");

Admin A = new Admin();A.main(args);

}

break;

case 2: {

System.out.println("Wecome to Seller page");

Seller B = new Seller();

B.main(args);

}

break;

case 3: {

System.out.println("Wecome to User page");

User U= new User();

U.main(args);

}

break;

case 4: {

System.out.println("Wellcome to New Customer page");

New_Customer N= new New_Customer();

N.printId();

}

break;

default:

System.out.println("Sorry! You Have Entered Wrong Choice Please Try Again .Thank You For Using E-Commerce Consol");

}

}

}

class Cart{

public static void addToCart() {

List CartProduct = new ArrayList();

System.out.println("Enter The Count Of Number Of Product You Want To Add In Cart ");

Scanner sc = new Scanner(System.in);

Integer n = sc.nextInt();

for(int i = 0 ; i <= n;i++) {

System.out.println("Enter The Name Of Product To Add Into the Cart .");

String [] CartItem = new String[n];

Pattern CartItem1 = sc.delimiter();

System.out.println(CartItem+ " Added to Cart Sucessfully ");

}

}

public static void removeFromCart(Scanner CartProduct) {

CartProduct.remove();

}

}

class New_Customer{

static Scanner sc = new Scanner(System.in);

public static String createPassword() {

System.out.println("Enter Password of your choice : ");

String Password = sc.next();

return Password;

}

public static String createId() {

System.out.println("Enter login id of your choice : ");

String Login_Id = sc.next();

return Login_Id;

}

public static void printId() {

System.out.println("Your Password Is "+ createPassword());

System.out.println("Your Login Id is " + createId());

}

}

class Catalog{

static Scanner sc = new Scanner(System.in);

String Product_Type = sc.next();

public static void AddToCatalog() {

System.out.println("Enter The Count Of Number Of Products You Wanted To Add In Catalog");

int n = sc.nextInt();

String[] array = new String[1000];

System.out.println("please Enter the Name Of Product To Add Inside Catalog");

for(int i = 0 ; i<=n ; i++){

array[i] = sc.next();

for(int j = 0 ; j<=n ; j++) {

System.out.println("Product"+array[j]);

for(int k = 0 ; k<=n ; k++) {

System.out.println("Enter The Price Of Product:");

int price = sc.nextInt();

for(int m = 0 ; m<= n ; m++){

System.out.println("Product Name"+array[i]+"Pice Of Product"+price);

}

}

}

}

}

public static void RemoveFromCatalog() {

int index =sc.nextInt();

for(int i=0;i<=Array.getLength(sc);i++ ) {

if(index == Array.getLength(sc)) {

System.out.println();

}

}

}

}

package project2;

import java.util.ArrayList;

import java.util.Scanner;

public class Product{

public static void main() {

Scanner sc = new Scanner(System.in);

// System.out.println(" Here The List Of Product :");

System.out.println("Choose The Product Type: 1.Electronic 2. Grocery 3. Stationary");

int Product = sc.nextInt();

switch(Product) {

case 1:

{

ArrayList<String> Electronic = new ArrayList<>();

Electronic.add("TV");

Electronic.add("REFRIGERATOR");

Electronic.add("WASHING MACHINE");

Electronic.add("AC");

Electronic.add("FAN");

Electronic.add("OWN");

Electronic.add("COLOR PRINTER");

Electronic.add("TV");

for(int i=0;i<8;i++) {

String element = Electronic.get(i);

System.out.println(element);

}

}

break;

case 2: {

ArrayList<String> Grocery = new ArrayList<>();

Grocery.add("APPLE");

Grocery.add("POTATOES");

Grocery.add("CARROTS");

Grocery.add("COCONUT OIL");

Grocery.add("STRAWBERRY");

Grocery.add("SOFT DRINK");

Grocery.add("PEAR");

Grocery.add("ALMONDS");

for(int i=0;i<8;i++) {

String element = Grocery.get(i);

System.out.println(element);

}

}

break;

case 3:

{

ArrayList<String> Stationary = new ArrayList<>();

Stationary.add("NOTEBOOK");

Stationary.add("PENCIL");

Stationary.add("ERASER");

Stationary.add("PAPER");

Stationary.add("PEN");

Stationary.add("WATER COLOUR");

Stationary.add("SKETCH PEN");

Stationary.add("MARKER");

for(int i=0;i<8;i++) {

String element = Stationary.get(i);

System.out.println(element);

}

}

break;

case 4:{

System.out.println("Sorry You Have Entered Wrong Chioce Please Try Againg");

Product P = new Product();

P.main();

}

}

}

public static void placeOrder() {

Product P = new Product();

P.main();

System.out.println("Enter The Name Of Product To Place An Order ");

Scanner sc = new Scanner(System.in);

String Porder = sc.next();

System.out.println("You Have Placed Order FOr :"+Porder);

System.out.println("Enter Your Current Address : ");

String Addrs = sc.next();

System.out.println("Enter payment mode : 1. cast on delivery 2. online payament(debit/creadit) 3. UPI payment");

int n = sc.nextInt();

switch(n) {

case 1:{

System.out.println("You Have Choose Option Of Cash On Delivery ");

}

break;

case 2:{

System.out.println("You Have Choose Option Of online Payment");

System.out.println("Enter Cart Type");

String CardType = sc.next();

System.out.println("Enter Your Card Number");

int NumC = sc.nextInt();

System.out.println("Enter the Card Validity Date ");

String DateV = sc.next();

System.out.println("Check Your Details Once ");

System.out.println("Your Card Type Is : "+CardType);

System.out.println("Your Card Number Is :"+NumC);

System.out.println("Your Card Validity Date : "+DateV);

}

break;

case 3:{

System.out.println("You Have Choose Option Of UPI Payment ");

System.out.println(" Enter YOur UPI Id ");

String UPI = sc.next();

}

break;

case 4:{

System.out.println("You Have Entered Wrong Choice Please Try Again!!");

Product p = new Product();

p.placeOrder();

}

break;

}

}

}

package project2;

import java.util.Scanner;

public class Customer {

public static void main(String[] args) {

System.out.println("Here The List Of Types of Produucts");

Product P = new Product();

P.main();

System.out.println("Enter Your choice 1. Add to Cart 2. Remove From Cart 3. Place An Order ");

Scanner sc = new Scanner(System.in);

int n = sc.nextInt();

switch(n) {

case 1:{

Cart c = new Cart();

c.addToCart();

}

break;

case 2:{

Cart c = new Cart();

c.removeFromCart(null);

}

break;

case 3:{

Product P1 = new Product();

P1.placeOrder();

}

}

}

}

package project2;

import java.util.Scanner;

public class User{

public static void main(String[] args) {

System.out.println("Enter Login ID : ");

Scanner sc = new Scanner(System.in);

String LoginId = sc.next();

System.out.println("Enter Password ");

String Password = sc.next();

Product p = new Product();

p.placeOrder();

}

}

package project2;

public class Seller {

public static void main(String[] args) {

Catalog c = new Catalog();

c.AddToCatalog();

c.RemoveFromCatalog();

}

}

package project2;

import java.util.Scanner;

public class Admin {

public static void main(String[] args) {

System.out.println("Enter Yor Choice If 1. Admin 2. User");

Scanner sc = new Scanner(System.in);

int n = sc.nextInt();

switch(n) {

case 1 :{

System.out.println("Admin Can Modify Catalog");

Catalog c = new Catalog();

c.AddToCatalog();

c.RemoveFromCatalog();

}

break;

case 2 :{

User u = new User();

u.main(args);

}

}

}

}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.