Feb24 - poudre.us

advertisement
Monday, February 24, 2014
Deliverables
Much of this two-page document was shared with you late last week, but with some small but critical
adjustments. Please read these two pages before working on Java today.
If you haven't already, today please move on to creating a few programs using the Java programming
language.
There are many more chapters available in the second textbook we are using, Python for Informatics:
Chapter 12 Networked programs, Chapter 13 Using Web Services, Chapter 14 Using databases and
Structured Query Language (SQL), Chapter 15 Visualizing data, and Chapter 16 Automating common
tasks on your computer.
However, it is understood that many of you this school year are also looking forward to working with
additional programming languages. It was promised that February would be a month that another
language would be formally introduced. That language is Java.
It is very easy to pick up another computer language once you have already learned one (or more). Java
is a little more involved to get up and running compared to Python. However once one is past the "Hello,
World!" test, it is easy to move on from there.
Resources for a beginner at Fossil to learn Java are posted on the site for the Intro to Computer Science
class, which is available via http://poudre.us. Once on the class page, select the Class Notes link and
check out the resources in Chapter 0. It has movies and word documents that can help you get started.
The big hurdle is to set up a Project in NetBeans, and then you can start creating program files within the
project. There are directions on how to set up a project in Chapter 0.
Here is the handout from Chapter 0 on how to set up a project in NetBeans:
http://staffweb.psdschools.org/sdurkin/RunNetBeans7Fall2013.pdf
Here is a movie of doing the same thing (it is a movie about how to get going with NetBeans at home, but
it shows how to first set up a project before you can start writing programs):
http://staffweb.psdschools.org/sdurkin/netbeansHome/index.html
As you know, a given substitute teacher may or may not be a programmer, so you individually and as a
group (help each other – oh, the video you want is that one …) will have to take on, at times, self-learner
roles, just like you have already done with regular expressions. This extra effort on your part is greatly
appreciated and will actually serve you well as so much of your learning over your lifetime will be selfdirected. Thank you for the maturity many of your are bringing to the table these weeks.
In room 209, NetBeans is installed on all the desktop computers. NetBeans is an IDE for Java, and is
actually available from Oracle bundles with the Java DK. The big hurdle to get started with NetBeans and
Java in 209 is first creating a project in NetBeans, and then in that newly created project you can write
your first program. There is a handout (Word) for how to create a project when sitting on a computer in
209. There is also a movie where the same thing is done, but on a computer at home. Java and NetBeans
are free.
TODAY: Get a NetBeans project created on your server. Create a HelloWorld-type program in
NetBeans within that project. Please post on your web site a "HelloWorld.java"- type program
that you wrote using NetBeans.
Maybe display something a little more interesting – check out the first program in the black/green
Java Solutions textbook (page 28) in the back cabinet – along with the exercises at the end of that
chapter.
Do note how Java will not do math in statements like this (it concatenates instead):
System.out.println("Here are two numbers: " + 1 + 2);
// displays: Here are two numbers: 12
To show math in a print statement, you need to not have any Strings in the argument.
System.out.print("Sum:);
System.out.println(1 + 2);
// displays: Sum: 3
Also note that if both operands are integers, it only does floor integer division:
System.out.println(7 / 2);
// displays: 3
For an exact answer, something this would work:
System.out.println(7.0 / 2*1.0);
// displays: 3.5
The % operator is the same as it is in Python.
After HelloWorld, try to make a simple program in Java that can find and display all the factors of
a million. Please post that work along with any other programs you are able to make in the time
allowed today. (Read the Java version of How to Think Like a Computer Scientist to learn about
conditionals, loops, etc.)
Post that program on your web site. On Wednesday this week, you will be provided a 20-some
page tutorial on how to easily make a GUI in Java using Swing.
Please continue to post work at the end of each class period.
Thank you! 
Download