use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog 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);
}
}
}
use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.
the class MainTask3 method catalogProductAndCategoryCreator.
static SvCatalog catalogProductAndCategoryCreator() {
SvCatalog catalog = new SvCatalog();
catalog.addProduct(new SvProduct(ProductCategory.SPORT, "Мяч", 30, ProductRank.HIGH));
catalog.addProduct(new SvProduct(ProductCategory.SPORT, "Гиря", 20, ProductRank.HIGH));
catalog.addProduct(new SvProduct(ProductCategory.ELECTRONIC, "Телефон", 100, ProductRank.HIGH));
catalog.addProduct(new SvProduct(ProductCategory.ELECTRONIC, "Ноутбук", 210, ProductRank.HIGH));
catalog.addProduct(new SvProduct(ProductCategory.HOUSEHOLD, "Кофеварка", 170, ProductRank.HIGH));
catalog.addProduct(new SvProduct(ProductCategory.HOUSEHOLD, "Блендер", 90, ProductRank.HIGH));
return catalog;
}
use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.
the class MainTask3 method svCatalogServiceTest.
static void svCatalogServiceTest(SvCatalog catalog, SvUser user) {
System.out.println("\nTest CatalogService:");
SvCatalogServiceImpl service = new SvCatalogServiceImpl();
service.showAllProducts(catalog);
service.showProductsByCategory(ProductCategory.ELECTRONIC, catalog);
// пока не знаю как здесь удобнее реализовать!!!!
// поэтому хардкорно передаем элемент списка.
service.addProductInBasket(user, catalog.getCatalogList().get(2));
service.addProductInBasket(user, new SvProduct(ProductCategory.HOUSEHOLD, "Блендер", 90, ProductRank.HIGH));
service.buyProduct(user, catalog.getCatalogList().get(2));
System.out.println("\nЧто может пользователь:");
for (UsersActions e : UsersActions.values()) {
System.out.println(e);
}
}
use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.
the class SvCatalogServiceImpl method showAllProducts.
@Override
public void showAllProducts(SvCatalog catalog) {
ArrayList<SvProduct> products = catalog.getCatalogList();
System.out.println("\nВсе товары в каталоге");
for (SvProduct p : products) {
System.out.println(p.toString());
}
}
use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.
the class MainTask3 method main.
public static void main(String[] args) {
SvCatalog catalog;
// Понадобится чтобы в дальнейшем не заморачиваться
catalog = catalogProductAndCategoryCreator();
SvUser user = new SvUser("User", "Qwerty");
svAuthenticationServiceTest(user);
svCatalogServiceTest(catalog, user);
}
Aggregations