Federal repaving contracts have been awarded to various contractors to
fix a number of sections of the nation's highway system. Each contract specifies
a single section, giving its starting and ending location. The number of feet of
highway in that section is the ending location minus the
starting location. For example, a section whose start is 2000 and whose end is 2001
is just one foot long. We need software to protect the
public from the possibility that contracts might be granted for overlapping
sections, leaving the government to pay multiple times for fixing that part.
We want a program that will examine the contracts and will tell us how
many feet of highway have been included in more than one contract. Create
a class RoadWork that contains a method fraudFeet that takes int[]
start and int[] end
as input and returns the number of feet of
highway that are included in more than one contract. Corresponding elements of
start and end give the starting and ending location of a contract.
|