Download presentation
Presentation is loading. Please wait.
1
Comp Sci 302 Introduction to Programming
Jim Williams, PhD
2
What is Computer Science?
What is Programming? With a name like computer science, you might think it is all about the computer. Core principles: Abstractions and algorithms This course: Learning to give instructions to the computer. Read and Write Java
3
What is Computer Science?
The study of the computer itself as well as how computers are applied to solve problems in any field. What is Programming? Designing algorithms and writing them in a language a computer can execute.
4
In Computer Science Lots of puzzles, problem solving and challenge.
Opportunity to create something from nothing Opportunity to apply to any field Many enjoy these and find a lot of satisfaction when successful.
5
CS Core Principles: Algorithms: A step-by-step set of operations to be performed. Abstraction: a technique for managing complexity.
6
Bloom's Taxonomy of Educational Goals
6. Create: Produce new or original work 5. Evaluate: Justify a stand or decision 4. Analyze: Draw connections among ideas 3. Apply: Use information in new situations 2. Understand: Explain ideas or concepts Remember: Recall facts and basic concepts What level is expected in high school, college? What is required to "get an A"? What is required in order to teach?
7
Understand vs. Apply Steph Curry, NBA Golden State Warriors
Basketball Analogy Demonstration vs. Practice Declarative Knowledge vs Procedural Knowledge Importance of Practice for learning Steph Curry, NBA Golden State Warriors
8
Who is in the class?
9
When Women Stopped Coding
10
Education, Race, Women & Computing
Unlocking the Clubhouse By Jane Margolis and Allan Fisher Stuck in the Shallow End By Jane Margolis
11
Memory, Sequence, Assignment
int i; int j; i = 5; j = i; Briefly Explain Draw a picture of memory Walk through Demonstrate in Java Visualizer
12
What are the values in a, b & c?
int a = 5; int b = 7; int c = a; b = c; a = b;
13
Swap values in a & b int a = 5, b = 3;
Write code to swap values in a & b. a = b; b = a; c = b; b = c; c = a; a = c; Google "swapping values without third variable" for many creative ways.
14
Print Out int numCars = 9; int numTrucks = 4;
System.out.print( numCars ); System.out.print( numCars + numTrucks); System.out.println( "numCars" + numTrucks); Ask for results Demonstrate in Java Visualizer
15
Print Out Starting with: int a = 5; int b = 3; Produce output: a has 5
System.out.print(a has 5); System.out.println(b has 3); System.out.print(a + " has " + 5); System.out.print(b + " has " + 3); System.out.println("a has 5"); System.out.print("b has 3"); System.out.print("a has " + a); System.out.println("b has " + b); Starting with: int a = 5; int b = 3; Produce output: a has 5 b has 3
16
Escape Sequences Special character sequences within a String
\n \" \\ \t System.out.print( "hello\n\t\"hi\"\ngoodbye"); hello "hi" goodbye
17
What is printed out? System.out.print( "Fred says \"hello\"\nthis morning."); Fred says "hello" this morning. Fred says hello\nthis morning. Fred says \"hello\"
18
Questions (Degrees Fahrenheit – 32) x 5 / 9 = Degrees Celsius
What symbols have different meanings in Java? What changes must be made to implement this equation in Java? Retrieval practice importance of committing to an answer
19
Eclipse IDE Opening project, copying in files
Style and Commenting Guides Strings I/O Calling methods Compiler & Runtime Errors Scanner reading a number
20
Review (Degrees Fahrenheit – 32) x 5 / 9 = Degrees Celsius
What symbols have different meanings in Java? What changes must be made to implement this equation in Java?
21
My List X vs * equals (==) vs assignment (=)
value is stored on the left hand side of assignment (=) operator Variables: name areas of computer memory, declare before use, declare type of data, initialize Variable names: start with letter, include letters numbers and _, but no spaces Conventions: camelCasing, spell out names Semicolon at the end of statements
22
Read In Values Recall: import java.util.Scanner;
Scanner input = new Scanner( System.in); int age = input.nextInt(); String name = input.nextLine(); Use print statements to see what is happening as code is executing.
23
What are values of variables?
name: Minsub\n age: 22\nCS major: name: Minsub\n22\CS age: name: Minsub age: 22 String note = "Minsub\n22\nCS"; Scanner input = new Scanner( note); String name = input.nextLine(); int age = input.nextInt(); String major = input.nextLine();
24
P1 - M0 Available P1 - Individual work Style and Commenting
4 weekly milestones, Due 8am Thursday P1 - Individual work Discuss concepts, don’t share assignment code Style and Commenting
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.