The task need to find the definite integral 4 methods

- using the method of the left rectangles

method right rectangles

method of average rectangles

method of trapezes

And to draw a graph for each method your. (graph drawn by points, which are obtained in the process of finding the integral, namely, in a loop)

Schedules and methods between similar.

What should I do ?

To create a class, which describe 4 methods of finding the integral of which will return values and write the points for the graph in the field, (point) will be used in another method in another class to the schedule.

Or maybe these methods will return a tuple with a collection of points and the value of the integral.

Or maybe you should stuff each method in different classes together with methods to create graphs.

Or anyone has better idea?

PS I, of course, would the idea still to paint, but I think that's obvious. A lot of ways, but some choose not to know.

- using the method of the left rectangles

method right rectangles

method of average rectangles

method of trapezes

And to draw a graph for each method your. (graph drawn by points, which are obtained in the process of finding the integral, namely, in a loop)

Schedules and methods between similar.

What should I do ?

To create a class, which describe 4 methods of finding the integral of which will return values and write the points for the graph in the field, (point) will be used in another method in another class to the schedule.

Or maybe these methods will return a tuple with a collection of points and the value of the integral.

Or maybe you should stuff each method in different classes together with methods to create graphs.

Or anyone has better idea?

PS I, of course, would the idea still to paint, but I think that's obvious. A lot of ways, but some choose not to know.

asked April 7th 20 at 15:33

2 answers

answered on

Solution

answered on

Solution

What is considered the right architecture? It all depends on the task. You can make 2 interface, describes the calculation and rendering. Implement these interfaces. To create specific instances to make an abstract factory that will return ready-made objects for calculation and rendering. Basically the program code create a factory derived objects and call their methods of calculation/rendering