Docsity

Java Programming: Understanding the Basics - Prof. Orlena C. Gotel, Assignments of Computer Science

Partial preview of the text

Download Java Programming: Understanding the Basics - Prof. Orlena C. Gotel and more Assignments Computer Science in PDF only on Docsity!

CS121:Getting Started

A) Programming Basics & Your 1 st Program B) Basic Ingredients & Simple Instructions Dr Olly Gotel [email protected] http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors

Today’s Agenda (Part A)

  • Syllabus / Questionnaires / History
  • Exercise – tour guide / the role of clear instructions
  • Groundwork:
    • programs, programmers, programming languages
  • Traditional first program – “Hello World!”
  • Getting started with Java and Eclipse

Questionnaire: Temperatures

Fahrenheit = ((9.0 / 5.0) * Celsius) + 32

Questionnaire: Flowcharts

  • Flow of logic, sequence of instructions, examples of John von Neumann Start i = 0 Print i i < 10 i = i + 1 Stop Yes No

Questionnaire: Getting Coffee

  • Leave until later…

History Time

“The History of Computers” Perhaps watch ‘ ‘Pirates of Silicon Valley’

What Have You Just Done?

  • In essence, you have just written a program!
  • You are a programmer!
  • You didn’t have to use any funny jargon! You used a

form of pseudocode to express an algorithm

  • You didn’t even have to touch a computer!
  • But is it precise and unambiguous? We’ll see later… Dispelling some myths -- programming is not scary!

Pseudocode

  • English-like description of how a program will work
  • High-level
  • Written in general terms
  • Programming-language independent

Instructions

  • On a bar of Dial soap:
    • Directions: Use like regular soap
  • On an American Airlines packet of nuts:
    • Instructions: open packet, eat nuts Task: Find an example of unclear / ambiguous instructions

Programmer

  • Person who writes programs:
    • responsible for identifying the sequence of instructions & writing them down in a form that the computer can understand
  • What about computers that write programs?
  • Who is the user? Task: write instructions to tie a shoe lace Task: draw instructions to tie a shoe lace

Why Learn to Program?

  • Write own programs
  • Program applications
  • To get a Computer Science / Information Systems degree
  • Power!
  • Fun?
  • Money…

Hardware & Software

  • Road system (traffic lights)
  • Think of the roads and traffic lights as hardware; think of the vehicles as auxiliary data being passed around the internals of the computer hardware; think of the procedure that determines when to change the traffic light colours as the software – the rules for passing data around Analogy

A Note on Binary

The machine only understands machine language, which consists of zeros and ones (current passing through or not)

Programming Language

  • A textual or visual language used to write a program
  • Why use a language?
  • Examples?
  • The meaning of the program has to be unambiguous & consistent
  • You have to be precise Compare with learning a “foreign” language