B= (1; 11; 5); A= (2; 6; 7); C= (3; 13; 9); D= (12; 7; 16); E= (14; 3; 25); F= (19; 18; 22); H= (23; 13; 29); G= (24; 4; 28)
8 ffff 7 ffff 6 ffff 5 ffff 4 ffff 3 cccccc ffffhhhhhhh 2 cccccc ffffhhhhhhh 1 bbbbbcccc ffffhhhhhhh 0 bbbbbcccc ffffhhhhhhh 9 bbbbbcccc ffffhhhhhhh 8 bbbbbcccc ffffhhhhhhh 7 bbbbbcccc ddddd ffffhhhhhhh 6 baaaaaacc ddddd ffffhhhhhhh 5 baaaaaacc ddddd ffffhhhhhhh 4 baaaaaacc ddddd ffffhgggggh 3 baaaaaacc ddeeeeeeeeeeeegggh 2 baaaaaacc ddeeeeeeeeeeeegggh 1 baaaaaacc ddeeeeeeeeeeeegggh 012345678901234567890123456789 1 2In the diagram above, building A is in front of B which is in front of C. Building E is in front of D, F, G, & H. G is in front of H.
1 11 5 2 6 7 3 13 9 12 7 16 14 3 25 19 18 22 23 13 29 24 4 28Sample Output
public class Skyline { /** Compute the skyline for a group of buildings. * @param rdr a reader that contains the input sequence of building triples. * @return an array of integers describing the skyline. */ public int[] compute(java.io.Reader rdr)Example invocation:
Skyline sky = new Skyline(); String set1 = "2 2 2\n3 3 3\n"; StringReader sr = new StringReader(set1); int[] result = sky.compute(sr);Note: Please design your own solution. While this algorithm is easy to find on the Web or in textbooks, please write your own algorithm from scratch. There are many approaches to the solution with a wide range of difficulty. You might consider several alternative designs before committing to one solution.
You must submit execution output that demonstrates that your program can produce the correct results for data in the Example above. This output can be created in one of two ways:
Write a JUnit test class and print the test source code and the successful test runner output.
Write a driver and a file of test input data. Print the driver source code, the input data file, and the execution output.
Perform any additional tests you want to convince yourself that your solution is correct.
In addition, your program must pass the instructor's acceptance test. Once you are satisfied that your program is correct and is passing your unit tests, create a new time log entry. Enter "Test" for the phase and in the comment field enter "Acceptance Testing".
Submit your source code using the Web-CAT grader. On this project the grader will not run your own unit tests. Web-CAT will report checkstyle errors in red and they WILL count in your total score. Each coding standard violation is a defect. The defect type is 10 for code syntax, and 80 for Javadoc errors. (Tip: To avoid getting style errors in Web-CAT, run the Checkstyle extension in BlueJ before submitting to Web-CAT.)
If Web-CAT reports any errors, tally
them in a new section of the defect tally with a removal phase of
"Acceptance Testing". You are allowed five Web-CAT
submissions without penalty. If you take more than five
submissions, your project earns only half-credit.
When Web-CAT assigns a 100% score to your work, you should finalize your work according to the assignment directions.