Thompson Rivers University
ProductTester Class Driver
Assignment 2 Product - SM 2025The ProductTester class is our main driver. It demonstrates how the entire system works using the Product, Category, and PasswordLockable implementations. Let’s walk through what this class is doing and why:
1. Creating the Product List
We first create an array of Product objects and store four sample products in it. Each product has a code, a description, a price, and a category.
Product[] productList = new Product[4];
productList[0] = new Product("A001", "Chicken", 72.45, Category.MEAT);
productList[1] = new Product("B002", "Milk", 22.35, Category.DAIRY);
productList[2] = new Product("C003", "Apples", 22.35, Category.PRODUCE);
productList[3] = new Product("D004", "Beef", 89.99, Category.MEAT);Members only
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 54 more lessons in Thompson Rivers University.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.