Make an application with the above classes for a client that comes with a list of items * that needs to purchase with the following ruleset: - At the beginning at least 5 different types of items must be added to the storage (use the method addItemQuantity() from Storage.class) - Then create a list of items of the client. - For every item first should be checked if the items are available (use getItemQuantity of Storage.class) - If an item is unavailable do not include it in the invoice - If the item is available include it in the invoice - After all the items are added to the invoice, show all the items added with the description, quantity and cost of the item. This final list should be shown ordered in alphabetical order. - output the invoice into a text file (invoice.text) and save it on the local PC.
public class Storage {
private final List<String> listQuantities;
public Storage() {
this.listQuantities = new ArrayList<String>();
}
public bool addItemQuantity(String quantity) {
this.listQuantities.add(quantity);
}
public List<String> getItemQuantity() {
return this.listQuantities;
}
}
Comments
Leave a comment