MSTU5031/Introduction
From Studyplace
Teachers College • Columbia University
MSTU5031 Navigator
Fall 2008
Thursday, 6:50 PM - 9:10 PM
Location: 234 HM
Antonios Saravanos, Instructor
Labs & Office Hours
Project Proposals
Course Participants
Programming Resources
Java Style Guide
Contents |
[edit] Key Concepts
- what we will cover, what is expected of students
- using the command line to compile and run Java programs
- Java basics review
[edit] Mini Lecture
- Why study programming?
- programming is everywhere
- blogs, wikis, mash-ups
- games, SecondLife
- macros, Excel, SPSS
- a common language for scholars and practitioners
- learn to think like a programmer
- process of abstraction and domain modelling
- algorithmic processes
- debugging
- project planning
- different paths for different people
- (non-technical) part of a team developing digital media
- advise school or organization on technology choices
- continue studying programming and/or computer science
- teach computer and programming courses
- for the pure joy of programming
- What you will learn in programming II
- object oriented programming concepts
- abstraction, objects (and classes), encapsulation, composition, inheritance, polymorphism
- new Java concepts
- Collections Framework
- Swing (Java GUIs)
- project management and software engineering basics
- How the class works
- readings
- homeworks
- class presentations
- projects
- portfolios & final exam
- grading
- Overview of Computler Languages
- What types of languages exists - scripting vs programming
- How have they evolved
- External Link: http://www.99-bottles-of-beer.net/?PHPSESSID=f5c2786b414368373bf4f7f6499947dc
- External Link of what features are included in most programming languages: **http://en.wikipedia.org/wiki/Comparison_of_basic_instructions_of_programming_languages
- Java on the command line
- opening Terminal
- moving around (cd and ls)
- compiling Java programms (javac SourceCode.java)
- running Java programs (java SourceCode)
- see the useful unix commands page for a very brief overview of how to use the command line
[edit] In-class Exercises
For these exercises, feel free to work with a partner, in teams, and to ask for help. This is not a test, but meant to get us re-acquainted with writing Java code.
1. Create an account on StudyPlace and add yourself to the [[MSTU5031/Participants|participants page].
2. Hello.java: write a program that prints out the String "Hello, world." to the console.
3. Loop.java: write a program that prints out all of numbers from 50 to 100 to the console
4. Odd.java: write a program that prints all of the numbers from 1 to 100 and indicates if they are odd or even. You will probably want to use the % modulus operator.[1]
Output: 1 odd 2 even 3 odd 4 even 5 odd 6 even ...
4. Prime.java: write a program that has a method that prints all of the prime numbers from start to end, taking start and end as parameters. findPrimes(1,10) would print:
2 3 5 7
[edit] Homework
Write a program called Convert.java which can calculate the following conversions and prints them to the console:
- convert from pounds to kilograms
- convert from kilometers to miles
- calculate the total number of seconds, given a certain number of days, hours, and minutes) hint: something like public static int calcSeconds(int days, int hours, int minutes)
- convert degrees Celsius to Farenheit
- write a test method that shows that your calculations are as you expect
- A good test method will tell you if your program works as expected -- without requiring any human interaction. That is, printing out the conversions and checking them by hand is not a sufficient test method.
- You do not need to create a user interface as part of this assignment (i.e. no menu that opens from a main method).
- Part of this assignment is to find the appropriate conversion scales/formulas.
*** Note: all homework must follow the Java Style Guide
[edit] Notes
- ↑ The modulus operator (%) returns the remainder of integer division. This is illustrated in the following code example:
//... System.out.println("5 % 2: " + 5 % 2); System.out.println("38 % 5: " + 38 % 5); /* Output 5 % 2: 1 38 % 5: 3 */
