[Solved] CENG112 Assignment 1-The Shopping App

$25

File Name: CENG112_Assignment_1-The_Shopping_App.zip
File Size: 348.54 KB

SKU: [Solved] CENG112 Assignment 1-The Shopping App Category: Tag:
5/5 - (1 vote)

This assignment covers the topics of:

  • Strings
  • Arrays
  • File I/O
  • ADTs
  • Generics
  • Bags

You are expected to implement The Shopping App using Java. In the app, the user has a fridge to fill and she/he can go to the mall to buy groceries.

When the user goes to the mall to shop, she/he has a basket with a size of 2000 grams. The user adds products to the basket. During shopping, the user can check the items that are in the basket already. If an item that the user selects cannot be added to the basket because of exceeding the basket capacity, your program should print a warning message. Shopping is finished when the user enters finish shopping, or the basket is full.

The items in the inventory of the mall are listed together in inventory.txt file where each line is formed as:

item_name,item_compartment,item_weight(grams)

After finishing shopping, the user heads home to fill her/his fridge. The fridge has four compartment with their limited size:

  • Vegetables and Fruits 3000 grams
  • Meats 5000 grams
  • Beverages 4000 grams
  • Snacks 2000 grams

Each item has to be put into their corresponding compartment. During the program run, you should be able to check the status of the fridge (remaining capacities of each compartment). If some of the items cannot be put to their corresponding compartments according to their remaining capacity, your program has to print a warning message. (e.g. If the remaining capacity of Vegetables and Fruits is 200 grams and you try to add a tomato to the fridge, the program should print a message like tomato cannot be added to the fridge).

After filling the fridge, the user can go shopping again, and return back to fill her/his fridge. Your program should end when the user enters exit, or all compartments are full.

Your code must have the interface, class and method implementations given below.The bullets (I), (C), and (M) stand for interface, class, method respectively.

  1. IBag
  2. public boolean add(T newItem);
  3. public boolean isEmpty();
  4. public boolean isFull();
  5. public T removeByIndex(int index);
  6. public T remove();
  7. public T remove(T item);
  8. public int getItemCount();
  9. public int getIndexOf(T item);
  10. public boolean contains(T item);
  11. public void displayItems();
  12. public void dump(); // removes all the items from the bag
  13. public boolean transferTo(IBag<T> targetBag, T item);
  14. ShoppingApp
  15. public static void main(String[] args);
  16. FileIO
  17. public static InventoryBag<Item> readInventory();
  18. Item
  19. public String toString();
  20. public boolean equals(Object obj);
  21. ShoppingBasket implements IBag
  22. MeatsCompartment implements IBag
  23. VegetablesFruitsCompartment implements IBag
  24. BevaragesCompartment implements IBag
  25. SnacksCompartment implements IBag

p.s. You can add more classes and methods to your program according to your design.

NOTE: While implementing your program please make sure that your program is user friendly. Try to make your user inputs simpler. For example, in a selection process rather than asking the user to write or type a long string, make the selections with numbers.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CENG112 Assignment 1-The Shopping App
$25