Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make with Java (30 points) You are going to develop a class to represent Products. *For the instance variables, add the below ones. Make sure

Make with Java image text in transcribed
image text in transcribed
(30 points) 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 e 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 thern. *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 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

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

Question What integration level should an employer choose?

Answered: 1 week ago