CS2133: Computer Science II Assignment 6 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

1 Class Design (20 points)
Design a class hierarchy (classes and/or interfaces) to support a program dealing with geographic objects. Support the following classes (at least): • Countries • States/Provinces • Cities • Boundary Segments • Rivers Support the following operations, where applicable, plus any others that seem useful (arguments have been omitted, but you will have to include them): • area() • capital() • getCities() • getCountry() • distance() – between cities • boundaryLength() – total length of boundary • neighbors() – objects sharing boundaries • borderOf() – the countries/states this separates Write out the class definitions, instance variables and method definitions. Some of the instance variables should probably be various kinds of Collections. You do not need to implement the methods, but you should include comments inside each method that describe the approach you would take (alternately, you can actually implement them – that might be simpler for some methods). Use interfaces and superclasses where appropriate. Supply javadoc comments for all classes, interfaces, and methods. The system you write should compile, even if it doesn’t actually work (because the methods are just stubs with comments). Note: This problem is deliberately openended. Don’t panic! Be creative! Extra credit: Be especially creative!
1
2 Permutations (30 points)
Implement a class that works like an iterator and generates all possible permutations of a list. It cannot actually be an Iterator, because the official Java Iterator interface looks like the following:
public interface Iterator