Opgepast! Het lijkt erop dat je Dodona gebruikt binnen een andere webpagina waardoor mogelijk niet alles goed werkt. Laat dit weten aan de lesgever zodat die het probleem kan oplossen door een instelling in de leeromgeving aan te passen. Ondertussen kan je op deze link klikken om Dodona te openen in een nieuw venster.
Opgepast! De pagina kon niet volledig ingeladen worden, waarschijnlijk door een netwerkprobleem. Het kan zijn dat niet alle functionaliteit beschikbaar is. Probeer de pagina te verversen.
Products
Log in om je oplossingen te testen.
import java.util.ArrayList;
public class StockManager
{
// A list of the products.
private ArrayList<Product> stock;
/**
* Initialise the stock manager.
*/
public StockManager()
{
stock = new ArrayList<>();
}
/**
* Add a product to the list.
* @param item The item to be added.
*/
public void addProduct(Product item)
{
stock.add(item);
}
/**
* Receive a delivery of a particular product.
* Increase the quantity of the product by the given amount.
* @param id The ID of the product.
* @param amount The amount to increase the quantity by.
*/
public void delivery(int id, int amount)
{
}
/**
* Try to find a product in the stock with the given id.
* @return The identified product, or null if there is none
* with a matching ID.
*/
public Product findProduct(int id)
{
return null;
}
/**
* Locate a product with the given ID, and return how
* many of this item are in stock. If the ID does not
* match any product, return zero.
* @param id The ID of the product.
* @return The quantity of the given product in stock.
*/
public int numberInStock(int id)
{
return 0;
}
/**
* Print details of all the products.
*/
public void printProductDetails()
{
}
}