Algorithms and OOD (CSC 207 2014S) : Assignments
This assignment is currently in draft form.
Due: 10:30 p.m., Wednesday, 12 February 2014
In this assignment, you will continue your exploration of a simple
Fraction class, extending the class to provide a
more maximalist interface. You will also use that class to build
an interactive calculator.
Purposes: To give you experience designing and implementing classes. To give you some opportunity to build interactive applications.
Collaboration: You must work in a group. Your group can be of size two, three, or four. Your group must include at least one person you did not work with on a prior assignment. (It's okay to work with someone who you did labs with.)
Wrapper (Prologue): Individually read through this assignment and make sure that you understand what is required. Then use the form available at http://bit.ly/207hw4pro to indicate (a) how long you think this assignment will take and (b) what you think will be the most challenging aspect of this assignment.
Wrapper (Epilogue): When you are done with the assignment, fill out the form available at http://bit.ly/207hw4epi to indicate (a) how long the assignment took, (b) what the most challenging part of the assignment was, and (c) something important you learned from doing the assignment. If you find that the assignment took much less or much more time than you expected, also include (d) a note as to what might have led to that difference.
Please put all of your work in a GitHub repository named
csc207-hw4. Email the address of that repository
Please use a subject of “CSC207 2014S Assignment 4
Warning: So that this assignment is a learning experience for everyone, we may spend class time publicly critiquing your work.
a. Create a new Eclipse project for this assignment. You can name the project whatever you like, provided it's not in bad taste.
b. You will need a Fraction class for this assignment. If you'd like, you may copy the Fraction class that we used in a recent lab as a starting point, but make sure to put an appropriate citation at the top.
Finish implementing the Fraction class that you started to design in assignment 2 and that you may have worked on separately. Make sure to write a few tests for each method you implement. (Yes, you should turn in the tests, too.)
Implement a class,
Calculator, that supports simple
calculations using fractions and integers. Your calculator should
support at least eight storage elements, labeled
Your calculator class should support
either an expression over fractions and storage elements or an
“assignment” of the form
evaluate should throw an appropriate exception
if the expression is malformed. (Ideally, you should find a way
to indicate the location of the error in the expression.)
Your calculator class should also support
evaluate(String expressions), the evaluation of a
sequence of expressions. For this, you should return an array
of the values created for each expression.
Create a user interface for the calculator. Your interface will primarily use the read-eval-print loop (aka REPL): read an expression, evaluate that expression, print the result, and do it all over again. You should find a nice way to report the errors.
Good designers separate program logic from the underlying computation. Please try to design your program so that it's easy to “swap out” one interface and to “swap in” another one.
This assignment grew from exercises in class and some discussions with students.
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
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.