Computer Science 202
Introduction to Programming

Fall 2012, The College of Saint Rose

Programming Project 1: Fractions
Due: 11:59 PM, Wednesday, September 26, 2012

For your first programming project, you will write a Java program that adds fractions.

Ground Rules

You must work individually on this program. While you may ask for help from your instructor or from the tutors in the Academic Support Center, that help will be more limited than for regular lab assignments. Additionally, any help you receive must be clearly documented in the comment at the top of your program (i.e., who helped you and exactly what that help was).

Program Requirements

Read these directions carefully and follow them precisely. Part of your grade will depend on you formatting prompts and printouts as described.

Here are two more example inputs and outputs.

If your input fractions are 1/3 and 5/6, the output should be:

The sum of 1/3 and 5/6 is 21/18.
That's 1.1666666666666667 in decimal notation.
Or 1 3/18 as a mixed number.

If your input fractions are 3/4 and 10/8, the output should be:

The sum of 3/4 and 10/8 is 64/32.
That's 2.0 in decimal notation.
Or 2 0/32 as a mixed number.

Can I Do This?

Rest assured that we have seen every Java feature you need to use in class examples and labs. If you find yourself thinking that there is something you don't know how to do, look over the class examples for something similar. You should not need, nor should you use, any Java constructs we have not yet covered in class.

Style and Documentation Reminders

Before you submit your program, make sure it conforms to our guidelines for style and documentation.

In particular, you should have a comment at the top of your class that describes your program and has your name, the course number and section (02 for 11:15, E1 for 4:10). You should have comments throughout your programs describing your variables and any non-obvious Java statements or groups of statements.

All identifiers (class names and variable names) should be meaningful and conform to Java's naming conventions.

Your code should be nicely formatted, with new lines after any { or }, and indented as done in class examples.

Bonus Opportunity

For a few bonus points, you may extend your program to work for a sum of three fractions.

Submitting Your Work

Before 11:59 PM, Wednesday, September 26, 2012, submit your Java program to Blackboard for grading. Please upload your Java source file ( - upload the one with the .java file extension, not the .class, .ctxt, package.bluej or README files).


This assignment is worth 50 points, which are distributed as follows:

> FeatureValueScore
Scanner construction 5
Correct prompts 5
Read and store inputs 5
Computing improper fraction 6
Computing decimal result 6
Computing mixed number result 6
Output formatting 5
Comments 5
Naming conventions 5
Formatting 2
Bonus up to 2
Total 50