Algorithms and OOD (CSC 207 2013F) : Assignments
This assignment is currently in draft form.
Due: 10:30 p.m., Tuesday, 24 September 2013
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.
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 me the address of that repository.
Please title your email “CSC207 2013F 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. If you'd like, you may copy the Fraction class that we wrote in class. If you do so, make sure to include an "@author CSC 207 2013F" at the top.
Finish implementing the Fraction class that you started to design in assignment 2 and that we worked on in class. Make sure to write a few tests for each method you implement.
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.
This assignment grew from exercises in class and some discussions with students.
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
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.