Search in sources :

Example 1 with Category

use of com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Category in project AN15 by IharDubkou.

the class Main method main.

public static void main(String[] args) {
    Basket basket = new Basket();
    Product product = new Product();
    Product product1 = new Product();
    Product product2 = new Product();
    product.setPrice(100);
    product.setRating(1);
    product.setName("Limon");
    product1.setPrice(200);
    product1.setRating(13);
    product1.setName("Orange");
    product2.setPrice(300);
    product2.setRating(7);
    product2.setName("Banana");
    Product[] products = new Product[] { product, product1, product2 };
    System.out.println(Arrays.toString(products));
    User user = new User();
    user.setLogin("Ybivator");
    user.setPassword("ybiica007");
    user.setBasket(basket);
    AuthenticationService authenticationService = new AutenticationImpl();
    authenticationService.authentication(user);
    Category category = new Category();
    category.setName("Овощи");
}
Also used : User(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.User) Category(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Category) AutenticationImpl(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.service.Impl.AutenticationImpl) Product(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Product) Basket(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Basket) AuthenticationService(com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.service.AuthenticationService)

Example 2 with Category

use of com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Category in project AN15 by IharDubkou.

the class Main method main.

public static void main(String[] args) {
    Product apple = new Product("Apple", 4.1, 4.3);
    Product lemon = new Product("Lemon", 1.2, 3.3);
    Product potato = new Product("Potato", 1.3, 4.9);
    Product onion = new Product("Onion", 1.7, 3.3);
    Product mayo = new Product("Mayo", 3.9, 3.7);
    Product milk = new Product("Milk", 2.4, 4.2);
    Product[] milks = new Product[2];
    Product[] fruits = new Product[2];
    Product[] vegetables = new Product[2];
    milks[0] = milk;
    milks[1] = mayo;
    fruits[0] = apple;
    fruits[1] = lemon;
    vegetables[0] = potato;
    vegetables[1] = onion;
    Category milksCat = new Category("Молочные и майонез", milks);
    Category fruitsCat = new Category("Фрукты", fruits);
    Category vegetablesCat = new Category("Овощи", vegetables);
    Category[] categories = new Category[3];
    categories[0] = milksCat;
    categories[1] = fruitsCat;
    categories[2] = vegetablesCat;
    // Login Password
    User user = new User("Login", "Password");
    Basket basket = new Basket();
    ArrayList<Product> products = new ArrayList<>();
    basket.setProducts(products);
    // тут аутентификация работает нормально
    Scanner scanner = new Scanner(System.in);
    System.out.println("Введите логин");
    String login = scanner.nextLine();
    System.out.println("Введите пароль");
    String password = scanner.nextLine();
    AuthenticationImpl authentication = new AuthenticationImpl();
    authentication.authentication(user, login, password);
    Menu(user, categories, basket);
}
Also used : Scanner(java.util.Scanner) Category(com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Category) User(com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.User) ArrayList(java.util.ArrayList) Product(com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Product) Basket(com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Basket)

Example 3 with Category

use of com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Category in project AN15 by IharDubkou.

the class SvCatalogServiceImpl method showProductsByCategory.

@Override
public void showProductsByCategory(ProductCategory category, SvCatalog catalog) {
    ArrayList<SvProduct> products = catalog.getCatalogList();
    System.out.println("\nВсе товары категории " + category.toString());
    for (SvProduct p : products) {
        if (p.getProductCategory().equals(category)) {
            System.out.println(p);
        }
    }
}
Also used : SvProduct(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvProduct)

Example 4 with Category

use of com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Category in project AN15 by IharDubkou.

the class Main method main.

public static void main(String[] args) {
    Category category1 = new Category();
    Category category2 = new Category();
    Category category3 = new Category();
    Product product1 = new Product("Гречка", 1, 47);
    Product product2 = new Product("Нут", 2, 65);
    Product product3 = new Product("Пшено", 1.5, 21);
    Product[] products1 = new Product[3];
    products1[0] = product1;
    products1[1] = product2;
    products1[2] = product3;
    category1.setName("Крупы");
    category1.setProducts(products1);
    Product product4 = new Product("Молоко", 2, 14);
    Product product5 = new Product("Кефир", 1.8, 28);
    Product product6 = new Product("Сметана", 1.4, 11);
    Product[] products2 = new Product[3];
    products2[0] = product4;
    products2[1] = product5;
    products2[2] = product6;
    category2.setName("Молочка");
    category2.setProducts(products2);
    Product product7 = new Product("Пирожок с мясом", 2.5, 78);
    Product product8 = new Product("Булочка с маком", 1.3, 92);
    Product product9 = new Product("Сметанник", 1.45, 88);
    Product[] products3 = new Product[3];
    products3[0] = product4;
    products3[1] = product5;
    products3[2] = product6;
    category3.setName("Булки");
    category3.setProducts(products3);
    Product[] products = new Product[3];
    products[0] = product7;
    products[1] = product4;
    products[2] = product1;
    Basket basket = new Basket();
    basket.setProducts(products);
    User user = new User("NEMO", 1234, basket);
    AuthenticationService authenticationService = new UserAuthenticationServiceImpl();
    CategoryService categoryService = new CategoryServiceImpl();
    // authenticationService.doLoginAndPassword(user);
    categoryService.printCatalog(category1);
    categoryService.printDefiniteCatalog(category1);
    categoryService.selectInBasket(1, basket, category1);
    categoryService.byInBasket(user, product5);
}
Also used : UserAuthenticationServiceImpl(com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.service.Impl.UserAuthenticationServiceImpl) CategoryService(com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.service.CategoryService) AuthenticationService(com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.service.AuthenticationService) CategoryServiceImpl(com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.service.Impl.CategoryServiceImpl)

Aggregations

Basket (com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Basket)1 Category (com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Category)1 Product (com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.Product)1 User (com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.classes.User)1 AuthenticationService (com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.service.AuthenticationService)1 AutenticationImpl (com.teachMeSkills.an15.LashkevichGeorgy.hw6.task3.service.Impl.AutenticationImpl)1 AuthenticationService (com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.service.AuthenticationService)1 CategoryService (com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.service.CategoryService)1 CategoryServiceImpl (com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.service.Impl.CategoryServiceImpl)1 UserAuthenticationServiceImpl (com.teachMeSkills.an15.MatveevArtyom.hw6.Inheritance.task3.service.Impl.UserAuthenticationServiceImpl)1 Basket (com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Basket)1 Category (com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Category)1 Product (com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.Product)1 User (com.teachMeSkills.an15.ShlyakhtichEvgeniy.hw6.task3.Shop.User)1 SvProduct (com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvProduct)1 ArrayList (java.util.ArrayList)1 Scanner (java.util.Scanner)1