Question: I need to pass in a Double number(class) into a sum class' constructor. I tried passing in an ArrayList of numbers . Basically the class

I need to pass in a Double number(class) into a sum class' constructor. I tried passing in an ArrayList of numbers . Basically the class sum can pass in any number of number objects. Need help building a versatile constructor such that sum can take in at least two number objects. Then the sum class need to add all of the number objects. (JAVA)

Basically the sum constructor can take any number of double:

//Constructor

class sum(num(obj), num(obj)){

}

method add(List){

iterate through all the number objects and print out the sum

}

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!