Skip to content

Commit

Permalink
Final commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yasmincsme committed Apr 18, 2023
1 parent 572fe52 commit 31c3024
Show file tree
Hide file tree
Showing 29 changed files with 1,153 additions and 209 deletions.
358 changes: 227 additions & 131 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public void update(Building building) throws Exception {
for (int i = 0; i < this.listOfBuilding.size(); i++) {
if (this.listOfBuilding.get(i).getID().equals(building.getID())) {
this.listOfBuilding.set(i, building);
return;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,71 @@ public class Building extends Service{

private List<ComputerComponent> usedComponents;

/**
*
* @param name Name of the Building
* @param description Description of the Building
* @param price Price of the Building
* @param cost Cost of the Building
*/
public Building(String name, String description, long price, long cost) {
super(name, description, price, cost);
this.usedComponents = new ArrayList<>();
}

/**
*
* @return Return Building's used components
*/
public List<ComputerComponent> getUsedComponents() {
return usedComponents;
}

/**
*
* @param usedComponents new value to used components
*/
public void setUsedComponents(List<ComputerComponent> usedComponents) {
this.usedComponents = usedComponents;
}

/**
* Add a new component to the component list
* @param component New component
*/
public void addComputerComponent(ComputerComponent component) {
this.usedComponents.add(component);
}

@Override
public long getPrice() {
/**
* Add the price of the used components to the subtotal
* @return Return the price that was fixed to the Building plus the additional price of the components
*/
public long increasePrice() {
long price = 0;
for (ComputerComponent component : this.usedComponents) {
price += component.getUnitPrice() * component.getQuantity();
}
return price;
return price + this.getPrice();
}

@Override
public long getCost() {
/**
* Add the cost of the used components to the subtotal
* @return Return the cost that was fixed to the Building plus the additional cost of the components
*/
public long increaseCost() {
long cost = 0;
for (ComputerComponent component : this.usedComponents) {
cost += component.getUnitCost() * component.getQuantity();
}
return cost;
}

public void addUsedComponent(ComputerComponent component, int quantity) {
component.setQuantity(component.getQuantity() - quantity);
this.usedComponents.add(component);
return cost + this.getCost();
}

/**
*
* @param object Receive a random object
* @return Return true if the given object is equal to the current Building object, or false if they are not the same
*/
@Override
public boolean equals(Object object) {
if (object instanceof Building) {
Expand All @@ -57,6 +83,10 @@ public boolean equals(Object object) {
return false;
}

/**
*
* @return Return a short formatted description of the object
*/
@Override
public String toString() {
return super.toString() + ", Service: Building" + ", Components: " + this.usedComponents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,47 @@ public class Cleaning extends Service{

private List<ComputerComponent> components;

/**
*
* @param name Name of the Cleaning
* @param description Description of the Cleaning
* @param price Price of the Cleaning
* @param cost Cost og the Cleaning
*/
public Cleaning(String name, String description, long price, long cost) {
super(name, description, price, cost);
this.components = new ArrayList<>();
}

/**
*
* @return Return Cleaning's component list
*/
public List<ComputerComponent> getComponents() {
return components;
}

/**
*
* @param components New value to component list
*/
public void setComponents(List<ComputerComponent> components) {
this.components = components;
}

/**
* Add a new component to the component list
* @param component New component
*/
public void addComponent(ComputerComponent component) {
this.components.add(component);
}

/**
*
* @param object Receive a random object
* @return Return true if the given object is equal to the current Cleaning object, or false if they are not the same
*/
@Override
public boolean equals(Object object) {
if (object instanceof Cleaning) {
Expand All @@ -34,6 +59,10 @@ public boolean equals(Object object) {
return false;
}

/**
*
* @return Return a short formatted description of the object
*/
@Override
public String toString() {
return super.toString() + ", Service: Cleaning" + ", Components: " + this.components;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,56 @@ public class Client extends Person {
private String phone;
private List<WorkOrder> workOrderList;

/**
*
* @param name Name of the Person
* @param email Email of the Person
* @param address Address of the Person
* @param phone Phone of the Person
*/
public Client(String name, String email, String address, String phone) {
super(name, email);
this.address = address;
this.phone = phone;
}

/**
*
* @return Return Client's address
*/
public String getAddress() {
return address;
}

/**
*
* @param address New value to address
*/
public void setAddress(String address) {
this.address = address;
}

/**
*
* @return Return Client's phone
*/
public String getPhone() {
return phone;
}

/**
*
* @param phone New value to phone
*/
public void setPhone(String phone) {
this.phone = phone;
}

/**
*
* @param object Receive a random object;
* @return Return true if the given object is equal to the current Client object, or false if they are not the same
*/
@Override
public boolean equals(Object object) {
if (object instanceof Client) {
Expand All @@ -39,6 +69,10 @@ public boolean equals(Object object) {
return false;
}

/**
*
* @return Return a short formatted description of the object
*/
@Override
public String toString() {
return super.toString() + ", Address: " + this.address + ", Phone: " + this.phone;
Expand Down
Loading

0 comments on commit 31c3024

Please sign in to comment.