Fundamentals of Computer Science II (CSC-152 97F)

[Front Door] [News] [Basics] [Syllabus] [Outlines] [Assignments] [Bailey Docs]


Assignment 1: Your first classes

Summary: For this assignment, you will write a few Java classes so as to familiarize yourself with the components and techniques for writing Java programs. You may not have learned all the information for this assignment by the time it was assigned, you will have learned it well in advance of the due date for the assignment.

Turning it in: Leave your code in a publically readable directory, and email me the location of that directory. Note that your directory should include documentation generated by javadoc. If this doesn't make sense to you, let me know.

A Fraction Class

Develop a simple Fraction class that implements simple fractions, with a numerator and denominator.

Your Fraction class should provide the following constructors

Your Fraction class should provide the following constructors

Once you have completed your basic class, create a class, TestFraction that provides a main routine that appropriate tests your routines. Here are some things that you might test:

Extra Credit

Make sure that your fractions are always irreducible. For example, the following code should print "1/2".

Fraction f = new Fraction(2,4);
System.out.println(f.toString());

Add any other routines that you consider appropriate for a Fraction class.


[Front Door] [News] [Basics] [Syllabus] [Outlines] [Assignments] [Bailey Docs]

Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

Source text written by Samuel A. Rebelsky.

Source text last modified Mon Sep 8 10:58:30 1997.

This page generated on Wed Sep 10 08:48:23 1997 by SamR's Site Suite.

Contact our webmaster at rebelsky@math.grin.edu