Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
HashMap Practice | Map
Java Data Structures
course content

Course Content

Java Data Structures

Java Data Structures

1. Basic Data Structures
2. Additional Data Structures
3. Map
4. enum & Stream API

bookHashMap Practice

Task

Task objective: Implement a simple database for an online store using HashMap.

It's time to tackle a truly extensive task where you'll need to apply all your Java skills and demonstrate your analytical thinking!

For you, classes Product and Customer have already been created. They have some fields, which you can check in the code. I've also written an interface with all the methods you need to implement, along with the implementation class.

You'll be working in the file codefinity.Task.OnlineStoreDatabaseImpl.java. This is where you'll write the code.

Here's a list of what you need to do:

  • Database Creation:
    • Using HashMap, create a database for products and customers.
  • Product Operations:
    • Implement methods for adding a new product, updating product information (e.g., changing price or quantity), and deleting a product from the database.
  • Customer Operations:
    • Implement methods for adding a new customer, updating customer information (e.g., changing address), and deleting a customer from the database.
  • Order Placement:
    • Create a method for placing an order, which takes the customerid, product id, and the quantity of product units. When placing an order, reduce the available quantity of the product in the database.
  • Information Display:
    • Implement methods for displaying information about all products and all customers in a readable list format.
  • Additional Features (optional):
    • Implement additional methods of your choice, such as searching for products by name, displaying information about customer orders, etc.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 3
some-alt