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).
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.
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:
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.
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.
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