Project Zero

Overview

The main objective of this project is to allow you to become familiar with the GitHub+Eclipse workflow you'll be using on later projects. It will also give you a little bit of practice writing code in Eclipse, and also get you started reading the Java API.

To start, make sure you've joined your "team" on GitHub (if you didn't get an automatic email about this, try logging into github, then visiting https://github.com/BC-CISC3120-S17). Once you've joined the team, go to the team page, and you shoud see a repository with project0 in its name. Copy the URL of the repository, then clone it into your Eclipse workspace: this should basically create a new project with a very bare-bones ProjectZero.java file. Your task is to complete this program so that it runs in accordance with the specifications below. You should commit your code frequently, and push your commits at the end of each work session (if not more frequently).

The Project

In the application activities, we've used Scanner objects to read input from the keyboard. For this project, we'll use Scanner to do an apparently simple thing: read in two numbers, then compute and print their sum. A run of your program would look something like this (user's text in red):

Enter two numbers: 4 5
The sum of 4 and 5 is 9.

However, there is one small twist: your program should let the user silently decide whether to enter numbers as integers or floating-point numbers (eg as int or as double ). Calculate the sum depending on the type of the user's entry. So your program should also run like this:

Enter two numbers: 4.2 5.45
The sum of 4.2 and 5.45 is 9.65.

Of course, your program should be able to deal with "mixed types":

Enter two numbers: 5 17.3
The sum of 5 and 17.3 is 22.3.

Note that you should not ask the user what type they're going to use— your input/output should be as simple as the sample runs above.

You should also deal gracefully (no ugly error/exception messages!) with the situation in which the user's input is not numerical. The Scanner class contains all the methods you need to do this easily.

Grading and Deadlines

Normally, I grade projects based on documentation, style, design, and correctness. (We'll talk more about this in class.) This is just a "starter," so the main emphasis is getting something done. Specifically:

I will grade out of 100 points, allocated as follows:

  1. 50% Completion Even if you have trouble getting this to work, or generating all the documentation, push something up to GitHub before the project is due. If you have trouble doing this, let me know as soon as possible.
  2. 25% Documentation. Your project should include three kinds of documentation, as described in the About Documentation page. You should provide doccomments for each class and method in your project, and generate HTML documentation using javadoc. For this project, the README needs only to contain a "Works Cited" section: Any website, book, or similar resource from which you get useful guidance must be listed here, along with a brief description of what you got from it (a bit of code? an explanation? an answer to a question?). You do not need to list the Java API or either of the two books required/recommended for class. If you use no other resources, then your "Works Cited" section must simply contain the word None.
  3. 25% Correctness Does your program work as it should?

On this project, and probably all projects this semester, you are to work strictly on your own. Specifically, you may neither show your code to, nor look at the code of, anyone else taking 3120 this semester. You may consult online/textbook resources (subject to the "Documentation" requirements above). You may certainly consult with me. You may, if you like, discuss your design at a high level with other students ("Oh, I found the java.foo.bar package to be really helpful," or, "Sure, I can explain the geometry of a paint window to you.").

The project is due at 11:59pm on the day of Class 9. At that time, I will clone your github repository (specifically, the master branch). Make sure all your code, documentation, etc., is current on github at that time.

A Note on Style

Usually, part of your grade depends on the style of your code. Here's what I expect: Your code should be properly formatted, with enough (but not too much) whitespace. Eclipse will do most of this for you; make sure you let it help you. Variable names, metohd names, etc, should all be "self-documenting" but not excessively long (one-letter variables names should only be used as loop counters). Generally, you can use any style you like, as long as you're consistent. If you're not sure what style to use, follow the GitHub Style Guide, except where Eclipse's automatic formatting contradicts these guidelines.

You can earn up to 10 points extra credit by implementing extra behaviors. Any extra behaviors you provide should be listed briefly in the README.md