lecture 1: 1226 review tami meredith. outline overview of programming java programs lots of...

34
CSCI1227 Computer Programming and Problem Solving Lecture 1: 1226 Review Tami Meredith

Upload: hubert-shepherd

Post on 17-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Slide 1

CSCI1227Computer Programming andProblem Solving Lecture 1: 1226 Review Tami MeredithOutlineOverview of ProgrammingJava ProgramsLots of Introduction

Goal

PerspectivesMost of you are not trying (or wanting) to become computer programmersThus, we focus on skills that are of value outside of programming:Attention to detail, following instructionsProblem solving, problem analysisStructured thinking, rule-based systemsDealing with unknowns, addressing uncertaintyFinding, reading, and applying technical documentationDealing with overwhelming technology

This course is as hard as, but different to (less math), CalculusProgramming in StepsIdentify the problem Figure out what we need to doDetermine the data we have and needSelect/design algorithms that manipulate the data in a manner that we can useTranslate the algorithms and data into Java (or any programming language)Execute the program and evaluate the resultsIf they are not correct, figure out why, fix, and retest (repeat as often as necessary)Coding Translating the solution to some problem into a format that a computer can use.Any trained monkey can write code! well, almost ...Java is just a brand of tool (as is VB, PHP, Javascript)We are not going to focus on coding in JavaWe are going to focus on programming: solving problems, designing solutions, implementing the solution (coding), and testing/evaluating solutions

First to the keyboard = Last to finish!

TradeoffsAll of computing requires the management of tradeoffs:Code: Complexity, Clarity, SimplicityPerformance: How fast it executesSize: Memory useUsability: Ease of use, Feature richnessThere is no correct balance or solution! Finding the right mix of elements is an art formProgrammers are like musicians, we can all play an instrument, but not all of us will be good at it ...

Source CodeA program is a set of instructions on how to do something.Programs are written in a programming language such as Java, C, Fortran, Visual Basic, Lisp, Pascal, Cobol ...Computers CAN NOT do anything with a Java Program!Thus, there is a sequence of events we must follow before a program can be executed or run.Translation into JavaFigure out what the program is called, e.g., helloCreate a file called hello.javaIn hello.java create a public class called helloIn class hello, create a method called mainMake main public so everyone can use it (it is required that main is public)Make main static so that we can use main without needing to instantiate the class (this is also required)main always has a return type of void and has a single parameter of type String[]ExerciseWrite a complete Java program that prints to the screen the alphabet, on one line, in lower case letters.E.g., your output should look like:

abcdefghijklmnopqrstuvwxyzSolutions/* The Alphabet (July 2013) By Tami Meredith for CSCI 1227 */public class alphabet { public static void main (String[] parms) { System.out.println("abcdefghijklmnopqrstuvwxyz"); > for (char c = 'a'; c