Code Handout to accompany the Final Exam CSCI 455 [S18 Bono] [Java] Select Java Scanner and File constructors: public File(String pathname) Creates File object from given pathname. Does not open any file on disk. public Scanner(File source) throws FileNotFoundException Constructs a new Scanner that produces values scanned from the specified file. FileNotFoundException (a checked exception) is thrown if source file is not found on disk. [Java] Set<ElmtType> Interface The classes that implement this interface are: TreeSet and HashSet. Selected methods: boolean contains(ElmtType elmt) Returns true iff elmt is in the set int size() Returns number of elements in the set boolean add(ElmtType elmt) Ensures that elmt is in the set. Returns true iff the set changed as a result of this call boolean remove(ElmtType elmt) Removes elmt from the set. Returns true iff the set changed as a result of this call boolean isEmpty() Returns true iff the set contains no elements. Iterator<ElmtType> iterator() Returns an iterator over the elements in the set. [Java] Iterator<ElmtType> Interface Selected methods: boolean hasNext() Returns true iff the iteration has more elements. ElmtType next() Returns the next element in the iteration. Each successive call returns a different element in the underlying collection. [Java] MazeCoord Class Selected methods: MazeCoord(int row, int col) Creates a maze coordinate object with the given row and column. int getRow() Returns the row of the coordinate int getCol() Returns the column of the coordinate [more on other side]Code Handout to accompany the Final Exam CSCI 455 [S18 Bono] [C++] Node type and ListType (this is the only part of the code handout with C++ code): struct Node { int data; Node * next; Node(int item); // create a Node with the given value and NULL next field // create a Node with the given data value (item) and next field (n) Node(int item, Node * n); }; typedef Node * ListType; [more on other
View Full Document