Algorithms and OOD (CSC 207 2013F) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [IRC] [Teaching & Learning]
Current: [Assignment] [EBoard] [Lab] [Outline] [Partners] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Overview
Admin
HW4
How should we evaluate the following?
r1 = 2/3
1 + r1
You should give something like the following
2/3, 5/3
What would you put in the Fraction class? (We'll do this as a group.)
Fraction(int,int)Fraction(int) - N/1Fraction(BigInteger,BigInteger)Fraction(Fraction) - That's just cloningFraction(BigInteger)Fraction(String) - new Fraction("11/15")Fraction(long,long)Fraction(double)Fraction add(Fraction other)Fraction subtract(Fraction other)Fraction multiply(Fraction other)Fraction divide(Fraction other)Fraction pow(int expt)double doubleValue()BigDouble bigDoubleValue()Fraction reciprocal()Fraction negate()BigInteger numerator()BigInteger denominator()Fraction fractionalPart()BigInteger wholePart()Fraction clone()String toString()int hashCode()int compareTo(Fraction other)boolean equals(Object other)void simplify()void cleanup()Fraction pow(Fraction expt)Fraction sqrt()Fraction log()BigInteger round()BigInteger ceiling()Hash code implementation
* `int hashCode() { return 1; }`
* `int hashCode() { return numerator.hashCode() * denominator.hashCode(); }`
Why won't my test code work
public void test() throws Exception {
...
}
+-------+
| Hello |
+-------+
Sample code
public class Counter {
int count;
int start;
public Counter(int i) {
this.count = i;
this.start = i;
} // Counter(int)
} // class Counter
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [IRC] [Teaching & Learning]
Current: [Assignment] [EBoard] [Lab] [Outline] [Partners] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions]
Related Courses: [CSC 152 2006S (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 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.