Question: code in Java, please answer within 80 minutes - i will give a thumbs up You are going to develop a cass to represent Products.
code in Java, please answer within 80 minutes - i will give a thumbs up
You are going to develop a cass 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 inot the default one) For this 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 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 We 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, this class with a main method Create a couple of products. Then create a category with these products. Buy them randomly. Search the products.ca the necessary methods and the end show us which product is the top product and which one is the most expensive one The peneral flow is up to you but make sure you call search methods. buy method, add method and tostring methods WHEN YOU ES STE YOUR CODE TO THE BELOW ARER, THE FORMAT SHOULD BE LIKE THIS COPY THE CLASS PRODUCI (ADD THIS DASHES TO SEPERATE THE CLASSES COPY THE CATEGORY CLASS ADD THIS DASHES TO SEPERATE THE GLASSES HUR MAN METHOD
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
