DOC PREVIEW
USC CSCI 455x - Code Handout

Previewing page 1

Save
Premium Document
Do you want full access? Go Premium and unlock all 1 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Code Handout to accompany Thursday’s final exam CSCI 455 [F13 Bono] String class (selected methods) char charAt(int index) Gets the char at position index (counting from 0) int length() The number of characters in the string. String substring(int beginIndex, int endIndex) Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. String substring(int beginIndex) Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the end of this string. ArrayList<ElmtType> class (selected methods) ArrayList<Integer> arrList = new ArrayList<Integer>(); // create empty arraylist that can hold ints arrList.add(3); // add a value to the end of the arrList int num = arrList.get(i); // returns element in in arrList arrList.set(i, 7); // update element in arrList int howMany = arrList.size()); // number of elements in arrList boolean empty = arrList.isEmpty(); // true iff arrList has no elements Math class (selected methods) static double floor(double a) Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. e.g., Math.floor(3.2)  3.0; Math.floor(3.0)  3.0 static double ceil(double a) Returns the largest (closest to positive infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer. (short for ceiling) e.g., Math.ceil(3.2)  4.0; Math.ceil(3.0)  3.0 static int min(int a, int b) Returns the smaller of two int values. static int max(int a, int b) Returns the greater of two int values. C++ Node type and ListType (this is the only part of the code handout with C++ code): struct Node { int data; Node * next; Node() { data = 0; next = NULL; } Node(int d) { data = d; next = NULL; } Node(int d, Node * n) { data = d; next = n; } }; typedef Node *


View Full Document

USC CSCI 455x - Code Handout

Download Code Handout
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Code Handout and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Code Handout 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?