Algorithms and OOD (CSC 207 2014S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Overview
Utility procedures fail
C model: Return special value
foo = malloc (100 * sizeof(mystruct)); if (foo == null) ...
throws Exception - can fail
throw new Exception(...) - failtry { code that may fail } catch (Exception e) { ... }
throws ExceptionsYou can use different kinds of exceptions to signal kinds of errors
public class DivergentSeriesException extends Exception { public DivergentSeriesException () { super(); } //
public DivergentSeriesException (String str) { super(str); } // }
Once we write that garbage, we can say `throw new DivergentSeriesException("Earnest says 'No!'");
try { doStringTheory(); } catch (DivergentSeriesException dse) { System.out.println("Physicists don't believe series diverge."); } catch (Exception e) { System.out.println("Please switch universes."); }
How do I test the quadratic root?
Make some quadratics whose roots you know. For example (x-3)(x+2) = x^2-x-6. The smaller root is -2.
What does assertEquals look like for doubles?
public static void assertEquals(java.lang.String message,
double expected,
double actual,
double delta)
How do I make an inputstreamreader?
BufferedReader eyes =
new BufferedReader(new InputStreamReader(System.in));
How do I convert a string to a double?
double d = Double.parseDouble(str);
Recent technical interview question
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Copyright (c) 2013-14 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by/3.0/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.