Question: java Problem 1 : Write a Generic Class that adds two numbers of different data types ( Integer , Double, Long ) and test it

java
Problem 1:
Write a Generic Class that adds two numbers of different data types (Integer, Double, Long) and
test it using your own examples.
Problem 2:
Write a Generic Class, that performs bubble sorting for an array, whose elements extend Comparable
class. Test it for sorting an array of Integer, Double and String data types.
Problem 3:
Modify your solution to Problem 2, introducing your own fancy compare method. This method
should compare the String data types taking into account the total number of characters; Integer
data types taking into account the total number of non-zero digits, and Double data types taking
into the significand (the mantissa) of the number.
Problem 4:
Use Upper Bounded Wildcard to sum all elements of the list of elements, which the extend Number
class. Test it using your own examples for different data types.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!