Cmpt 225
Simon Fraser University
School of Computing Science
Cmpt 225 - Assignment #3
English - French Translator
due date: Sunday, March 11 @ 23:59:59
Before We Start
The following is a list of topics we recommend you
have a good understanding of in order to successfully complete this
assignment:
-
Four phases of the Software Development Process
-
Abstract data type (ADT)
-
Object references or pointers
-
Trees
-
File I/O
-
Big O Notation
-
Inheritance (perhaps, depending on your solution)
-
Recursion
But first, read this assignment in its entirety before diving into it!
You are free to select either Java or C++ when implementing your solution
to this assignment.
Have fun!
Objectives
In this assignment, you will gain experience
-
performing the phases of the software development process while developing
an object-oriented program,
-
creating an ADT data collection class,
-
manipulating nodes in a hierarchical data structure using references (Java)
or pointers (C++),
-
implementing inheritance (perhaps, depending on your solution),
-
implementing recursion,
-
throwing and catching exceptions (using exception handling),
-
using files to perform input and output,
-
using the Big O Notation,
-
commenting and documenting your design.
English - French Translator
Problem Statement
You are to build an English - French
Translator. Your translator must allow the user to perform the following
functions:
-
Translation: Translate an English word into a its corresponding French
equivalence.
-
Insertion: Enter a new pair of words (English - French) into the translator.
-
Update: Modify an existing pair of words (English - French) from the translator.
This signifies that the user can modify the English word of the pair and/or
the French word of the pair.
-
Removal: Remove an existing pair of words (English - French) from the
translator.
-
Display: Display all the word pairs in English (not French) alphabetical
sorting order. Make sure that your display layout is clear enough so that
one can tell which French word is the translation of which English word.
Requirements
-
Your ADT data collection class must be flexible. This signifies that one
can reuse it to store any type of objects into it, such as Resource objects,
Person objects, Account objects, etc.
-
Your translation function must perform in O(log n) where n
is the number of word pairs in your translator.
-
Your insertion function (inserting 1 new pair of words into the
translator) must perform in O(log n).
-
Your display function must be a recursive method (Java) or recursive
function (C++). However, feel free to implement more than one method/function
recursively. Another way of designing flexible ADT data collection classes
is by ensuring that their methods/functions are free of I/O statements.
So, in order to implement the display function of your translator,
you may make use of an iterator.
-
At start up, your translator prompts the user for the filename of an input
file that contains several English - French word pairs. Your translator
then opens and reads the input file. This is a quick and easy way to populate
your translator. The format of this input file must be as follows: <English
word>:<French word>.
For example, here is the content of a possible input file:
fifty:cinquante
fill:remplir
finally:finalement
As you can see, there must only be one pair of English - French
words per line.
-
To build your input file, you will need a listing of French words. Such
listings abound on the Internet. Here is one such web site:
http://mypage.bluewin.ch/a-z/cusipage/basicfrench.html
-
At shut down, your translator must store the content of the ADT data collection
class (i.e., English - French word pairs) back into the input file only
if needed, i.e., only if the data that was originally loaded from the input
file has been either modified, augmented or decreased.
-
Keeping English words in lower case letters may ease your task.
-
For Java software developers: You must name your English - French Translator
class (the class with the main method) EFT.java. The reason
for this is that it will be easier for the marker to execute your translator.
S/he will simply need to type this command in order to execute your English
- French Translator:
java EFT
General Requirements
Getting Started
-
As in Assignments #1 and #2, the first thing you will need to do is ensure
that the problem statement and the requirements stated in this assignment
are clear to you. Feel free to drop by the instructor's office hours with
your questions. Once the problem statement and the requirements stated
in this assignment are clear, you can proceed to Phase 1 - Design, etc.
Testing
-
Make sure you test your translator using all sorts of input files (empty
input file, input files containing only 1 word pair, input files containing
many word pairs, etc.).
Submission
Assignment #3 is due Sunday, March 11 @ 23:59:59.
You must electronically deliver this assignment via the Submission program.
More specifically, you must submit:
-
All your source files (Java or C++ code) properly named. Only submit your
*.java files (for Java) OR h.* and *.cpp (and template) files as well as
your C++ makefile or .dsw files (for Visual C++). Do not submit your *.class
files (for Java) OR your executable file (for C++). Do not create Java
packages nor Jar files, instead, put all your source files in one directory,
namely the
src directory (see below).
-
Pick 3 methods/functions of your ADT data collection class. These
must include the methods/functions insert and remove. The
third one must not be the method/function size. Create two
test plans for each of those 3 methods/functions for a total of 6 test
plans. Put all your 6 test plans in a document named either TestPlan.html
or
TestPlan.txt or TestPlan.pdf. You also need
to submit the test driver implementing all your 6 test plans. Make sure
that your test driver produces helpful output statements explaining the
testing process as it unfolds.
-
All of your input files appropriately named.
When zipping your Assignment #3 directory, make sure you have the following
directory structure:
-
your top directory must be called assn3
-
it must contain a completed copy of the file cover_page.html
or cover_page.txt
-
it must also contain the following three subdirectories:
-
src -> which must contain all your translator code and your
test driver code.
-
doc -> which must contain your TestPlan.html
or TestPlan.txt or TestPlan.pdf file
-
data -> which must contain all of your input files appropriately
named.
Note that in this assignment you do not have to submit your UML design
diagram or your algorithms. You are, however, strongly
advised to practice creating such documents. You can present them to your
TA's and instructor for feedback.
Anne Lavergne - Last revision date: October
2006