Pra Ori
Pra Ori
You are tasked with designing a system to manage manufacturers and their products.
The system involves the following:
Class Manufacturer:
Attributes:
- manufacturerld (int)
- noOfProducts (int)
Create getters, setters and constructor for the above Manufacturer class.
Create a non-static method that calculates and returns the average price of all
products for a s. ified manufacturer.
- It should fetch all products associated with the given 'manufacturerld' and
calculate the average price.
- It should search for all manufacturers that produce the product with the given
'productName' and return a list of manufacturer names.
- If no manufacturers are found for the given 'productName', the method should
throw a custom exception called 'ProductNotFoundException', which includes the
message "Product Not Found".
Note:
-Write the code for accepting inputs, printing outputs and calling the non-static
methods in the main method from the Manufacturer Tester class.
-You can refer to the sample input/output below to verify your solution.
-Don't use any static test or formatting for printing the result. Just invoke the
methods and prime result.
Sample Input 1:
2
2001
Dell
2
Laptop
800
Monitor
300
2002
HP
2
Printer
150
Laptop
750
2001
Laptop
Sample Output 1:
550.0
Dell
HP
Sample Input 2:
2
5001
Tesla
2
Model S
80000
Model X
90000
5002
Ford
2
Mustang
40000
F-150
45000
6000
Cybertruck
Sample Output 2:
Manufacturer Not Found
Product Not Found