Skip to content

Última atualização #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ba804aa
feat: add note modified in readme
RayanArgolo03 Oct 19, 2023
7a4a5d9
feat: fork repo
RayanArgolo03 Oct 20, 2023
9b01ea4
fix: test
RayanArgolo03 Oct 20, 2023
138c85f
Merge branch 'main' of https://github.com/RayanArgolo03/Online-Shoppi…
RayanArgolo03 Oct 20, 2023
f7ef3d1
refactor: adding try catch to exceptions
RayanArgolo03 Oct 21, 2023
b6fc777
refactor: changed names and remove desnecessary add method
RayanArgolo03 Oct 22, 2023
6e29b6b
refactor: domain package
RayanArgolo03 Oct 22, 2023
f21f273
refactor: entities package
RayanArgolo03 Oct 22, 2023
e469f5d
refactor: enums package
RayanArgolo03 Oct 22, 2023
6255b1b
feat: add interfaces package
RayanArgolo03 Oct 22, 2023
3b2ca29
feat: add services package
RayanArgolo03 Oct 22, 2023
722b17b
remove: desnecessary exception
RayanArgolo03 Oct 22, 2023
7c2d8c1
refactor: change run method call logic
RayanArgolo03 Oct 23, 2023
3f43d93
refactor: changing atributtes name
RayanArgolo03 Oct 23, 2023
c7463e3
refactor: remove Order
RayanArgolo03 Oct 23, 2023
1f47384
feat: add equals and hash code in product
RayanArgolo03 Oct 23, 2023
cc97d7b
feat: add equals and hash code in purchase
RayanArgolo03 Oct 23, 2023
5b47c35
fix: add identation
RayanArgolo03 Oct 23, 2023
bb01b11
feat: add enums package
RayanArgolo03 Oct 23, 2023
72afd92
feat: add payment service default, implementing payment methods
RayanArgolo03 Oct 23, 2023
248c97d
feat: add payments service for decoupling
RayanArgolo03 Oct 23, 2023
4a84e83
refactor: refactor methods
RayanArgolo03 Oct 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Online Shopping System


## Forked repository for study by Rayan Argolo 🤪
Simulates the process of **browsing** products, **adding** them to a cart, **viewing** the cart, **removing** items, and **checking out**. This project involves designing classes representing various aspects of an online store, implementing **CRUD (CREATE, READ, UPDATE, DELETE)** operations, and incorporating additional functionalities.

# Used technologies
Expand Down Expand Up @@ -39,3 +41,5 @@ Pure Java utilizing OOP principles (Inheritance, Polymorphism, Abstraction, and

## What did I learn or improve from this project?
With the construction of this project I was able to improve my skills with the Java language and in solving problems that arose during the course of the project, I was able to benefit greatly as I did the project 100% alone without any help or ideas. According to needs, I implemented and arranged features in the program to make it as complete as possible. In the future, I want to evolve this project with new knowledge such as design patterns, unit tests with JUnit, etc.

# Modified by Rayan
18 changes: 9 additions & 9 deletions src/com/br/onlineshoppingsystem/application/App.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.br.onlineshoppingsystem.application;

import com.br.onlineshoppingsystem.entities.ShoppingSystem;

import java.util.Locale;
package com.br.onlineshoppingsystem.application;

import com.br.onlineshoppingsystem.services.ShoppingSystemService;

public class App {
public static void main(String[] args) {
Locale.setDefault(Locale.US);

ShoppingSystem shoppingSystem = new ShoppingSystem();
shoppingSystem.run();

public static void main(String[] args) {
try {
//Calling the method directly, so as not create object instance in the method
new ShoppingSystemService().run();
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
}
37 changes: 0 additions & 37 deletions src/com/br/onlineshoppingsystem/domain/Customer.java

This file was deleted.

33 changes: 33 additions & 0 deletions src/com/br/onlineshoppingsystem/domain/customer/Customer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

package com.br.onlineshoppingsystem.domain.customer;

import com.br.onlineshoppingsystem.domain.shopping.Cart;

public class Customer {

private String name;
private String email;
private long adress;
private Cart cart;

public Customer(String name, String email, long adress, Cart cart) {
this.name = name;
this.email = email;
this.adress = adress;
this.cart = cart;
}

public String getName() {
return name;
}

public String getEmail() {
return email;
}

public Cart getCart() {
return cart;
}

public long getAdress() {return adress;}
}
24 changes: 24 additions & 0 deletions src/com/br/onlineshoppingsystem/domain/shopping/Cart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.br.onlineshoppingsystem.domain.shopping;

import java.util.ArrayList;
import java.util.List;

public class Cart {
private List<Purchase> purchases = new ArrayList<>();

public Cart() {
}

public List<Purchase> getPurchases() {
return purchases;
}

public boolean removePurchase(Purchase p) {
return purchases.remove(p);
}

public boolean addPurchase(Purchase purchase) {
return purchases.add(purchase);
}

}
44 changes: 44 additions & 0 deletions src/com/br/onlineshoppingsystem/domain/shopping/Product.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.br.onlineshoppingsystem.domain.shopping;

import com.br.onlineshoppingsystem.enums.Category;

import java.util.Objects;

public class Product {
private String name;
private String description;
private Double price;

public Product(String name, String description, Double price, Category category) {
this.name = name;
this.description = description;
this.price = price;
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}

public Double getPrice() {
return price;
}


@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Product product = (Product) o;
return Objects.equals(name, product.name) && Objects.equals(description, product.description) && Objects.equals(price, product.price);
}

@Override
public int hashCode() {
return Objects.hash(name, description, price);
}

}
42 changes: 42 additions & 0 deletions src/com/br/onlineshoppingsystem/domain/shopping/Purchase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.br.onlineshoppingsystem.domain.shopping;

import java.util.Objects;

public class Purchase {
private Product product;
private int quantity;

public Purchase(Product product, int quantity) {
this.product = product;
this.quantity = quantity;
}

public Product getProduct() {
return product;
}
public int getQuantity() {
return quantity;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Purchase purchase = (Purchase) o;
return Objects.equals(product, purchase.product);
}

@Override
public int hashCode() {
return Objects.hash(product);
}

public void incrementQuantity(int quantity){
this.quantity += quantity;
}
public void decrementQuantity(int quantity){
this.quantity -= quantity;
}


}
11 changes: 0 additions & 11 deletions src/com/br/onlineshoppingsystem/entities/EMenuOption.java

This file was deleted.

18 changes: 0 additions & 18 deletions src/com/br/onlineshoppingsystem/entities/IShoppingSystem.java

This file was deleted.

42 changes: 0 additions & 42 deletions src/com/br/onlineshoppingsystem/entities/Order.java

This file was deleted.

39 changes: 0 additions & 39 deletions src/com/br/onlineshoppingsystem/entities/Products.java

This file was deleted.

50 changes: 0 additions & 50 deletions src/com/br/onlineshoppingsystem/entities/ShoppingCart.java

This file was deleted.

Loading