SlideShare a Scribd company logo
COMPSCI 121: INTRODUCTION TO
PROGRAMMING
FALL 2019
WHAT ARE THE GOALS FOR TODAY’S CLASS
• Introduce you to some java
programming constructs.
• Introduce you to problem solving
techniques.
• Demo: using jGRASP
• Point out good programming practices.
2
LET’S PRACTICE T-P-S
Think
How do you learn best? (2 mins)
Pair
Share your thoughts with
your neighbor (2 mins)
Share
A few insights with the class (2 mins)
3
WHY ARE WE USING JAVA?
4
● Java is a widely used language in
industry.
● Knowledge of Java is in high demand.
● It is a mature language (1995) and is
frequently updated.
● Helps you learn other languages.
● Created as a “Software Engineering”
language so that large programs can be
more easily developed and maintained.
● It is designed to support software best
practices.
WHY ARE WE USING JAVA?
TIOBE Index for August 2019
https://www.tiobe.com/tiobe-index/
5
6
QUESTIONS?LET’S START PROGRAMMING
PROGRAMMING STEPS & PATTERN
7
Best to write a little
code, test it,
debug (find and
remove errors) if
test(s) failed, or
continue to write
more code if the
test(s) passed.
Note:
A computer can only
execute one step at a
time. Each step must be
clearly defined.
PROGRAMMING STEPS
All programming has this pattern:
8
Read and analyze all aspects of the
problem the program is to address.
Make sure you understand what the
program should do- its logic. What are
the inputs and outputs to the program?
Write a step-by-step process, an
algorithm, that will use the input to
produce the expected output.
Write code that will correctly
implement some or all of the
algorithm.
Test some or all of the program:
compare program output to correct
output given a set of inputs.
Continue to
develop the
program or
debug if any
tests did not
pass.
BAKING ANALOGY
• Problem: I want some banana bread.
• Input: The ingredients.
• Output: Warm banana bread to eat!
• Test: Must be edible and must look and taste like
banana bread.
• Algorithm: A step-by-step plan, like a recipe, for
getting from the Input to the Output.
• Implementation: in this case, ME!
9
AN ALGORITHM YOU CAN ENJOY!
10
1. Preheat oven to 350 degrees F (175 degrees C).
2. Lightly grease a 9x5 inch loaf pan.
3. In a large bowl, combine flour, baking soda and salt.
4. In a separate bowl, cream together butter and brown sugar.
5. Stir in eggs and mashed bananas until well blended.
6. Stir banana mixture into flour mixture; stir just to moisten.
7. Pour batter into prepared loaf pan.
8. Bake in preheated oven for 60 to 65 minutes.
9. Bake until a toothpick inserted into center of the loaf comes out
clean.
10. Let bread cool in pan for 10 minutes.
11. Turn out onto a wire rack.
12. Test the output!
In this case, there is no way to partially
implement the algorithm, so if the test
fails, you’ll have to start over!
HOW DOES PROGRAMMING IN JAVA WORK?
1. The problem is analyzed
and understood.
2. Inputs and outputs
defined.
3. An algorithm is
designed.
4. Then, Java code is
written in one or more
source code files.
5. This file is compiled and
run.
6. The output is generated.
7. Tests can be run on the
output.
11
DEMO IN zyBooks AND JGRASP
Saving files in folders
Compiling & running the Salary program (from zyBooks).
Printing in single/new lines.
Making/removing syntax errors.
12
PROBLEM STATEMENT & ANALYSIS
Write a program that calculates the annual salary
given the hourly wage.
1. What are the inputs?
2. What are the outputs?
THINK - PAIR - SHARE!
13
DESIGN THE ALGORITHM
Write a program that calculates the annual salary
given the hourly wage.
1. What are the inputs? hourly wage
2. What are the outputs? annual salary
3. What is the algorithm (steps) for the program?
THINK - PAIR - SHARE!
14
DESIGN THE ALGORITHM
3. What is the algorithm (steps) for the program?
1. Get the hourly rate (for example, from user).
hourlyWage = ?
2. Calculate the annual salary:
hoursPerWeek = 40, weeksPerYear = 50
annSalary = hourlyWage * hoursPerWeek * weeksPerYear
3. Print the result.
15
WRITE THE JAVA CODE - CHECK FOR ERRORS
16
Line numbers Class name
Variable assignment
Output statements
Semi-colons
DEMO IN
JGRASP
{ } braces for scope
Declare a variable
Note: Code in jGRASP is color-coded
CLICKER QUESTION #1
On which line does the program start when it runs?
A. On the first line of the program public class Salary
B. With the main statement public static void main
C. With the print statement System.out.print
17
ANSWER CLICKER QUESTION #1
On which line does the program start?
A. On the first line of the program public class Salary
B. With the main statement public static void main
C. With the print statement System.out.print
18
HOW DO WE ASSIGN VALUES TO VARIABLES?
Assignment statements: create a variable and assign a
value to it.
int num = 450;
• LHS has to be a variable, RHS has to resolve to a value.
19
value
assignment
operator
data
type variable
name
RHSLHS
“Declaration” of the variable
“num” with data type “int”.
It also assigns the value 450 to
that variable.
ASSIGNMENT IN JAVA: WHAT HAPPENS IN MEMORY
20
EXAMPLE:
After the execution of the last statement, the variable “num1” now
references an integer value of 3.
State diagram
ASSIGNMENT IN JAVA: WHAT HAPPENS IN MEMORY
21
Notice that you declare a variable only once,
but can use it as much as necessary once it’s
declared.
You cannot re-declare a variable:
int a = 450;
int a = 450;
int a = 22;
declaration OK
re-declaration Not OK
You can re-assign a variable:
int a = 450;
a = 22; re-assignment OK
CLICKER QUESTION 2
Which variable holds the highest number?
1. int num = 14;
2. int num2 = (num + 1);
3. int num3 = num2;
4. num2 = num3 + 3;
5. num = 17;
A. num
B. num2
C. num3 22
ANSWER CLICKER QUESTION 2
Which variable holds the highest number?
1. int num = 14;
2. int num2 = (num + 1);
3. int num3 = num2;
4. num2 = num3 + 3;
5. num = 17;
A. num = 17
B. num2 = 18
C. num3 = 15 23
HOW DID WE SHOW THE OUTPUT TO THE USER?
24
Uses "" to output a string literal.
Multiple output statements continue printing
on the same output line.
Uses "" to output a string literal.
Starts a new output line after the
outputted values, called a newline.
CLICKER QUESTION 3
Given this code (assume variables have been declared):
hourlyWage = 20, hoursPerWeek = 40, weeksPerYear = 50;
annSalary = hourlyWage * hoursPerWeek * weeksPerYear;
Which one does not print 40000?
A. System.out.print(annSalary);
B. System.out.print(hourlyWage * hoursPerWeek *
weeksPerYear);
C. System.out.print(“annSalary”);
D. System.out.print(20 * 40 * 50);
25
CLICKER QUESTION 3
Given this code (assume variables have been declared):
hourlyWage = 20, hoursPerWeek = 40, weeksPerYear = 50;
annSalary = hourlyWage * hoursPerWeek * weeksPerYear;
Which one does not print 40000?
A. System.out.print(annSalary);
B. System.out.print(hourlyWage * hoursPerWeek *
weeksPerYear);
C. System.out.print(“annSalary”);
D. System.out.print(20 * 40 * 50); 26
PROBLEM: HOW DO WE GET USER INPUT FOR OUR PROGRAM?
For our Salary program, we want the user to input the wage from
the keyboard.
Solution: we use the special Java text parser called Scanner.
Steps:
1. Create a Scanner object: Scanner scnr = new Scanner(System.in);
System.in corresponds to keyboard input.
2. Given Scanner object scnr, get an input value and assign to a
variable with scnr.nextInt()
scnr.nextInt()is a function (method) that gets the input
value of type integer (int)
27
USING SCANNER TO GET USER INPUT FROM KEYBOARD
28
Import the Scanner class
Create instance
Scanner method
TESTING FOR LOGIC ERRORS
29
Now let’s calculate the monthly salary.
What if our program works but the output is wrong?
GRADING CRITERIA OF PROGRAMMING PROJECTS
Code Style: follows good style (as defined in the course
material). This means your code is readable to you and to
others. This is professional “best practice”.
Code Compiles: A program that doesn't compile cannot run and
is not a successful program. This program does not get credit.
Logical Correctness: The code is logically correct if it runs and
produces the correct output.
30
CLICKER QUESTION 4
A. All that glittersis not gold.
B. All that glitters is not gold.
C. All that glitters isnot gold.
D. All that glitters is not gold.
What is the output of running this file?
31
CLICKER QUESTION 4 ANSWER
A. All that glittersis not gold.
B. All that glitters is not gold.
C. All that glitters isnot gold.
D. All that glitters is not gold.
What is the output of running this file?
Watch
white
spaces!
32
SOME GOOD PROGRAMMING PRACTICES
1. Create a good solution (algorithm) first, before you start coding.
2. Compile after writing only a few lines of code, rather than writing
tens of lines and then compiling.
3. Make incremental changes— Don't try to change everything at
once.
4. Focus on fixing just the first error reported by the compiler, and
then re-compiling.
5. When you don't find an error at a specified line, look to previous
lines.
6. Be careful not type the number "1" or a capital I in
System.out.println.
7. Do not type numbers directly in the output statements; use the
variables.
33
Week 1 TODO List:
1. Register your iClicker in Moodle.
2. Install OpenJDK and jGRASP.
3. Complete zyBook chapter 1 exercises.
4. Attend lab on Friday with your laptop.
5. Read the course documents (Moodle).
6.Give your consent to use Gradescope.
7.Complete the Orientation Quiz in Moodle.
8.Ask questions in Piazza.
34

More Related Content

PPTX
An Interactive Guide to Creating a Simple LabVIEW Program
DOC
Comp 122 lab 4 lab report and source code
PDF
PDF
Week 2
DOCX
Cmis 102 Effective Communication / snaptutorial.com
PDF
Pengenalan algoritma dasar dalam pemrograman
DOCX
COMP 122 Entire Course NEW
An Interactive Guide to Creating a Simple LabVIEW Program
Comp 122 lab 4 lab report and source code
Week 2
Cmis 102 Effective Communication / snaptutorial.com
Pengenalan algoritma dasar dalam pemrograman
COMP 122 Entire Course NEW

Similar to Week 1 (20)

PPT
Flow charts week 5 2020 2021
DOCX
Cmis 102 Enthusiastic Study / snaptutorial.com
DOCX
Cmis 102 Success Begins / snaptutorial.com
PDF
Monte Carlo Simulation for project estimates v1.0
PDF
Week 5
PDF
Week 5
DOCX
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
PPT
2.2 Demonstrate the understanding of Programming Life Cycle
PPTX
jhdgqwuysuty1yyd uhudgqwygd ueu1eu2.pptx
PPT
01SoftwEng.pptInnovation technology pptInnovation technology ppt
PPTX
classVII_Coding_Teacher_Presentation.pptx
DOCX
Sample Questions The following sample questions are not in.docx
PPTX
Programming in C - Problem Solving using C
PPTX
CODE TUNINGtertertertrtryryryryrtytrytrtry
PPTX
Java developer trainee implementation and import
PPSX
Understanding Simple Program Logic
PPT
Flowcharting week 5 2019 2020
DOC
Cis 115 Education Redefined-snaptutorial.com
PPT
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
PPT
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Flow charts week 5 2020 2021
Cmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.com
Monte Carlo Simulation for project estimates v1.0
Week 5
Week 5
COMP 2213X2 Assignment #2 Parts A and BDue February 3 in cla.docx
2.2 Demonstrate the understanding of Programming Life Cycle
jhdgqwuysuty1yyd uhudgqwygd ueu1eu2.pptx
01SoftwEng.pptInnovation technology pptInnovation technology ppt
classVII_Coding_Teacher_Presentation.pptx
Sample Questions The following sample questions are not in.docx
Programming in C - Problem Solving using C
CODE TUNINGtertertertrtryryryryrtytrytrtry
Java developer trainee implementation and import
Understanding Simple Program Logic
Flowcharting week 5 2019 2020
Cis 115 Education Redefined-snaptutorial.com
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Ad

More from EasyStudy3 (20)

PDF
Week 7
PDF
Chapter 3
PDF
Week 6
PDF
2. polynomial interpolation
PDF
Chapter2 slides-part 2-harish complete
PDF
PDF
Chapter 5
PDF
Lec#4
PDF
Chapter 12 vectors and the geometry of space merged
PDF
Chpater 6
PDF
Chapter 5
PDF
Lec#3
PDF
Chapter 16 2
PDF
Chapter 5 gen chem
PDF
Topic 4 gen chem guobi
PDF
Gen chem topic 3 guobi
PDF
Chapter 2
PDF
Gen chem topic 1 guobi
PDF
Chapter1 f19 bb(1)
Week 7
Chapter 3
Week 6
2. polynomial interpolation
Chapter2 slides-part 2-harish complete
Chapter 5
Lec#4
Chapter 12 vectors and the geometry of space merged
Chpater 6
Chapter 5
Lec#3
Chapter 16 2
Chapter 5 gen chem
Topic 4 gen chem guobi
Gen chem topic 3 guobi
Chapter 2
Gen chem topic 1 guobi
Chapter1 f19 bb(1)
Ad

Recently uploaded (20)

PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
Introduction to Building Materials
PDF
Complications of Minimal Access Surgery at WLH
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
advance database management system book.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Lesson notes of climatology university.
Supply Chain Operations Speaking Notes -ICLT Program
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Weekly quiz Compilation Jan -July 25.pdf
LDMMIA Reiki Yoga Finals Review Spring Summer
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Introduction to Building Materials
Complications of Minimal Access Surgery at WLH
Practical Manual AGRO-233 Principles and Practices of Natural Farming
advance database management system book.pdf
Final Presentation General Medicine 03-08-2024.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
History, Philosophy and sociology of education (1).pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Final Presentation General Medicine 03-08-2024.pptx
RMMM.pdf make it easy to upload and study
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
What if we spent less time fighting change, and more time building what’s rig...
A systematic review of self-coping strategies used by university students to ...
Lesson notes of climatology university.

Week 1

  • 1. COMPSCI 121: INTRODUCTION TO PROGRAMMING FALL 2019
  • 2. WHAT ARE THE GOALS FOR TODAY’S CLASS • Introduce you to some java programming constructs. • Introduce you to problem solving techniques. • Demo: using jGRASP • Point out good programming practices. 2
  • 3. LET’S PRACTICE T-P-S Think How do you learn best? (2 mins) Pair Share your thoughts with your neighbor (2 mins) Share A few insights with the class (2 mins) 3
  • 4. WHY ARE WE USING JAVA? 4 ● Java is a widely used language in industry. ● Knowledge of Java is in high demand. ● It is a mature language (1995) and is frequently updated. ● Helps you learn other languages. ● Created as a “Software Engineering” language so that large programs can be more easily developed and maintained. ● It is designed to support software best practices.
  • 5. WHY ARE WE USING JAVA? TIOBE Index for August 2019 https://www.tiobe.com/tiobe-index/ 5
  • 7. PROGRAMMING STEPS & PATTERN 7 Best to write a little code, test it, debug (find and remove errors) if test(s) failed, or continue to write more code if the test(s) passed. Note: A computer can only execute one step at a time. Each step must be clearly defined.
  • 8. PROGRAMMING STEPS All programming has this pattern: 8 Read and analyze all aspects of the problem the program is to address. Make sure you understand what the program should do- its logic. What are the inputs and outputs to the program? Write a step-by-step process, an algorithm, that will use the input to produce the expected output. Write code that will correctly implement some or all of the algorithm. Test some or all of the program: compare program output to correct output given a set of inputs. Continue to develop the program or debug if any tests did not pass.
  • 9. BAKING ANALOGY • Problem: I want some banana bread. • Input: The ingredients. • Output: Warm banana bread to eat! • Test: Must be edible and must look and taste like banana bread. • Algorithm: A step-by-step plan, like a recipe, for getting from the Input to the Output. • Implementation: in this case, ME! 9
  • 10. AN ALGORITHM YOU CAN ENJOY! 10 1. Preheat oven to 350 degrees F (175 degrees C). 2. Lightly grease a 9x5 inch loaf pan. 3. In a large bowl, combine flour, baking soda and salt. 4. In a separate bowl, cream together butter and brown sugar. 5. Stir in eggs and mashed bananas until well blended. 6. Stir banana mixture into flour mixture; stir just to moisten. 7. Pour batter into prepared loaf pan. 8. Bake in preheated oven for 60 to 65 minutes. 9. Bake until a toothpick inserted into center of the loaf comes out clean. 10. Let bread cool in pan for 10 minutes. 11. Turn out onto a wire rack. 12. Test the output! In this case, there is no way to partially implement the algorithm, so if the test fails, you’ll have to start over!
  • 11. HOW DOES PROGRAMMING IN JAVA WORK? 1. The problem is analyzed and understood. 2. Inputs and outputs defined. 3. An algorithm is designed. 4. Then, Java code is written in one or more source code files. 5. This file is compiled and run. 6. The output is generated. 7. Tests can be run on the output. 11
  • 12. DEMO IN zyBooks AND JGRASP Saving files in folders Compiling & running the Salary program (from zyBooks). Printing in single/new lines. Making/removing syntax errors. 12
  • 13. PROBLEM STATEMENT & ANALYSIS Write a program that calculates the annual salary given the hourly wage. 1. What are the inputs? 2. What are the outputs? THINK - PAIR - SHARE! 13
  • 14. DESIGN THE ALGORITHM Write a program that calculates the annual salary given the hourly wage. 1. What are the inputs? hourly wage 2. What are the outputs? annual salary 3. What is the algorithm (steps) for the program? THINK - PAIR - SHARE! 14
  • 15. DESIGN THE ALGORITHM 3. What is the algorithm (steps) for the program? 1. Get the hourly rate (for example, from user). hourlyWage = ? 2. Calculate the annual salary: hoursPerWeek = 40, weeksPerYear = 50 annSalary = hourlyWage * hoursPerWeek * weeksPerYear 3. Print the result. 15
  • 16. WRITE THE JAVA CODE - CHECK FOR ERRORS 16 Line numbers Class name Variable assignment Output statements Semi-colons DEMO IN JGRASP { } braces for scope Declare a variable Note: Code in jGRASP is color-coded
  • 17. CLICKER QUESTION #1 On which line does the program start when it runs? A. On the first line of the program public class Salary B. With the main statement public static void main C. With the print statement System.out.print 17
  • 18. ANSWER CLICKER QUESTION #1 On which line does the program start? A. On the first line of the program public class Salary B. With the main statement public static void main C. With the print statement System.out.print 18
  • 19. HOW DO WE ASSIGN VALUES TO VARIABLES? Assignment statements: create a variable and assign a value to it. int num = 450; • LHS has to be a variable, RHS has to resolve to a value. 19 value assignment operator data type variable name RHSLHS “Declaration” of the variable “num” with data type “int”. It also assigns the value 450 to that variable.
  • 20. ASSIGNMENT IN JAVA: WHAT HAPPENS IN MEMORY 20 EXAMPLE: After the execution of the last statement, the variable “num1” now references an integer value of 3. State diagram
  • 21. ASSIGNMENT IN JAVA: WHAT HAPPENS IN MEMORY 21 Notice that you declare a variable only once, but can use it as much as necessary once it’s declared. You cannot re-declare a variable: int a = 450; int a = 450; int a = 22; declaration OK re-declaration Not OK You can re-assign a variable: int a = 450; a = 22; re-assignment OK
  • 22. CLICKER QUESTION 2 Which variable holds the highest number? 1. int num = 14; 2. int num2 = (num + 1); 3. int num3 = num2; 4. num2 = num3 + 3; 5. num = 17; A. num B. num2 C. num3 22
  • 23. ANSWER CLICKER QUESTION 2 Which variable holds the highest number? 1. int num = 14; 2. int num2 = (num + 1); 3. int num3 = num2; 4. num2 = num3 + 3; 5. num = 17; A. num = 17 B. num2 = 18 C. num3 = 15 23
  • 24. HOW DID WE SHOW THE OUTPUT TO THE USER? 24 Uses "" to output a string literal. Multiple output statements continue printing on the same output line. Uses "" to output a string literal. Starts a new output line after the outputted values, called a newline.
  • 25. CLICKER QUESTION 3 Given this code (assume variables have been declared): hourlyWage = 20, hoursPerWeek = 40, weeksPerYear = 50; annSalary = hourlyWage * hoursPerWeek * weeksPerYear; Which one does not print 40000? A. System.out.print(annSalary); B. System.out.print(hourlyWage * hoursPerWeek * weeksPerYear); C. System.out.print(“annSalary”); D. System.out.print(20 * 40 * 50); 25
  • 26. CLICKER QUESTION 3 Given this code (assume variables have been declared): hourlyWage = 20, hoursPerWeek = 40, weeksPerYear = 50; annSalary = hourlyWage * hoursPerWeek * weeksPerYear; Which one does not print 40000? A. System.out.print(annSalary); B. System.out.print(hourlyWage * hoursPerWeek * weeksPerYear); C. System.out.print(“annSalary”); D. System.out.print(20 * 40 * 50); 26
  • 27. PROBLEM: HOW DO WE GET USER INPUT FOR OUR PROGRAM? For our Salary program, we want the user to input the wage from the keyboard. Solution: we use the special Java text parser called Scanner. Steps: 1. Create a Scanner object: Scanner scnr = new Scanner(System.in); System.in corresponds to keyboard input. 2. Given Scanner object scnr, get an input value and assign to a variable with scnr.nextInt() scnr.nextInt()is a function (method) that gets the input value of type integer (int) 27
  • 28. USING SCANNER TO GET USER INPUT FROM KEYBOARD 28 Import the Scanner class Create instance Scanner method
  • 29. TESTING FOR LOGIC ERRORS 29 Now let’s calculate the monthly salary. What if our program works but the output is wrong?
  • 30. GRADING CRITERIA OF PROGRAMMING PROJECTS Code Style: follows good style (as defined in the course material). This means your code is readable to you and to others. This is professional “best practice”. Code Compiles: A program that doesn't compile cannot run and is not a successful program. This program does not get credit. Logical Correctness: The code is logically correct if it runs and produces the correct output. 30
  • 31. CLICKER QUESTION 4 A. All that glittersis not gold. B. All that glitters is not gold. C. All that glitters isnot gold. D. All that glitters is not gold. What is the output of running this file? 31
  • 32. CLICKER QUESTION 4 ANSWER A. All that glittersis not gold. B. All that glitters is not gold. C. All that glitters isnot gold. D. All that glitters is not gold. What is the output of running this file? Watch white spaces! 32
  • 33. SOME GOOD PROGRAMMING PRACTICES 1. Create a good solution (algorithm) first, before you start coding. 2. Compile after writing only a few lines of code, rather than writing tens of lines and then compiling. 3. Make incremental changes— Don't try to change everything at once. 4. Focus on fixing just the first error reported by the compiler, and then re-compiling. 5. When you don't find an error at a specified line, look to previous lines. 6. Be careful not type the number "1" or a capital I in System.out.println. 7. Do not type numbers directly in the output statements; use the variables. 33
  • 34. Week 1 TODO List: 1. Register your iClicker in Moodle. 2. Install OpenJDK and jGRASP. 3. Complete zyBook chapter 1 exercises. 4. Attend lab on Friday with your laptop. 5. Read the course documents (Moodle). 6.Give your consent to use Gradescope. 7.Complete the Orientation Quiz in Moodle. 8.Ask questions in Piazza. 34