Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA You are going to develop a class to represent Products. *For the instance variables, add the below ones. Make sure that these values

IN JAVAimage text in transcribed

You are going to develop a class to represent Products. *For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes. Name of the product Price of the product Number of purchases *Write at least two constructors (not the default one) (Hint: When you first create a product, purchases should be 0) *For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation) *Add an additional buy method that increases the purchase amount *Override the toString method. Return everything in a proper format. *Implement a class that will represent a Category. *For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes. name of the category number of products products[] *Write at least two constructors (not the default one) *For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation) *Write one additional method to add products to a category. *Write one additional method to search a product by the product's name in this category. If you can find it, return it. *Write one additional method to search a product by the price in this category. If you can find a product or products with that price, display them. *Write another method to decide the top-selling product in this category, display it. (which is the most purchased product.) *Override the toString method. Return everything including the product names. *Finally, use this class with a main method. Create a couple of products. Then create a category with these products. Buy them randomly. Search the products, call the necessary methods and at the end show us which product is the top product and which one is the most expensive one. The general flow is up to you but make sure you call search methods, buy method, add method and tostring methods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

Explain the characteristics of an effective appraisal system.

Answered: 1 week ago

Question

Discuss the states of accounting

Answered: 1 week ago

Question

What were the issues and solutions proposed by each team?

Answered: 1 week ago