Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop 2 classes: Product and Category organized as - The product class has fields id, name, quantity, and the Category class has a category name.-

Develop 2 classes: Product and Category organized as
- The product class has fields id, name, quantity, and the Category class has a
category name.- Classes must have getters and setters, and a toString method.
- Classes must implement the details of the association.
- Add constructors as needed for your driver class (below)
Develop a driver class Search that is used to test your class implementations. There are 3
things that Search must do:
a) Create the following 8 category instances and keep these in an array list.
Beverages
Condiments
Confections
Dairy Products
Grains/Cereals
Meat/Poultry
Produce
Seafood
b) Create each product instance indicated in as3q4.txt. Each product has an id, name,
quantity on hand, and a category it belongs to. As each product is created it must be
added to the product list for the appropriate category.
When reading as3q4.txt we recommend that you read a line
String line = f.nextLine();
and then with another scanner, get each field e.g.
String s = new Scanner(line).useDelimiter(",");
c) Prompt the user for a category name, and then display the products (id, name,
quantity on hand) for that category.
Enter a category:
Produce
Category: Produce
7 Uncle Bob's Organic Dried Pears 15
14 Tofu 35
28 Rössle Sauerkraut 26
51 Manjimup Dried Apples 20
74 Longlife Tofu 4







Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Using Excel & Access for Accounting 2010

Authors: Glenn Owen

3rd edition

1111532672, 978-1111532673

More Books

Students also viewed these Programming questions

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago

Question

What can you do in Access to change the structure of a database?

Answered: 1 week ago