Ask a question from expert

Ask now

Area of rectangles union.

1 Pages188 Words190 Views
   

Added on  2019-09-16

Area of rectangles union.

   Added on 2019-09-16

BookmarkShareRelated Documents
Area of rectangles union-Given N rectangles with edges parallel to axis, calculate the area of the union of all rectangles.-A rectangle is specified by giving its smallest and largest x- and y-coordinates x1, x2, y1, y2, where x1 < x2 and y1 < y2.-Bottom left corner is at (x1, y1) and the upper right corner at (x2, y2).-The area of this rectangle is given by the formula (x2 – x1)*(y2 – y1)Rectangles may intersect each other or may even be inside each other.-The task is to write a program in Java that reads n rectangles and return the total area.-The complexity should not be O(n2). The format of the input is:-<Number of rectangles>-<x1> <x2><y1>y2>-<x1> <x2><y1>y2>-......Output file should contain 1 number - the resulting area of the rectangles' union
Area of rectangles union._1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Object Oriented Programming using Java
|14
|585
|389

Rectangle Class Code
|12
|1173
|295

Rectangle Class in Java
|7
|1167
|75

Area of Parallelogram, Triangle, Rectangle, Cuboid, Swimming Pool
|9
|716
|51

Designing a Website for Pitch and Slope Calculator
|13
|1388
|396

Workshop 2 CT619
|11
|1306
|421