SlideShare a Scribd company logo
Java Programming: From Problem Analysis to Program Design, 3e Chapter 1 An Overview of Computers and Programming Languages
Chapter Objectives Learn about different types of computers Explore the hardware and software components of a computer system Learn about the language of a computer Learn about the evolution of programming languages Examine high-level programming languages Java Programming: From Problem Analysis to Program Design, 3e
Chapter Objectives (continued) Discover what a compiler is and what it does Examine how a Java program is processed Learn what an algorithm is and explore problem-solving techniques Become aware of structured and object-oriented programming design methodologies Java Programming: From Problem Analysis to Program Design, 3e
Introduction Computers have greatly affected our daily lives – helping us complete many tasks Computer programs (software) are designed specifically for each task Software is created with programming languages Java is an example of a programming language Java Programming: From Problem Analysis to Program Design, 3e
An Overview of the History of Computers The first device known to carry out calculations was the abacus The abacus uses a system of sliding beads on a rack for addition and subtraction Blaise Pascal invented the calculating device called the Pascaline Java Programming: From Problem Analysis to Program Design, 3e
An Overview of the History of Computers (continued) In 1819, Joseph Jacquard, a French weaver, discovered that the weaving instructions for his looms could be stored on cards with holes punched in them In the early and mid-1800s, Charles Babbage, an English mathematician and physical scientist, designed two calculating machines—the difference engine and the analytical engine Java Programming: From Problem Analysis to Program Design, 3e
An Overview of the History of Computers (continued) The first computer-like machine was the Mark I Built in 1944  Used punched cards to feed data into the machine  52 feet long, weighed 50 tons, and had 750,000 parts In 1946, ENIAC (Electronic Numerical Integrator and Calculator) was built at the University of Pennsylvania.  Contained 18,000 vacuum tubes and weighed some 30 tons Java Programming: From Problem Analysis to Program Design, 3e
An Overview of the History of Computers (continued) In 1956, the invention of the transistors resulted in smaller, faster, more reliable, and more energy-efficient computers  This era also saw the emergence of the software development industry with the introduction of FORTRAN and COBOL, two early programming languages In 1970, the microprocessor, an entire CPU on a single chip, was invented  Java Programming: From Problem Analysis to Program Design, 3e
An Overview of the History of Computers (continued) In 1977, Stephen Wozniak and Steven Jobs designed and built the first Apple computer in their garage  In 1981, IBM introduced its personal computer (PC) Modern-day computers are very powerful, reliable, and easy to use Can accept spoken-word instructions and imitate human reasoning through artificial intelligence Java Programming: From Problem Analysis to Program Design, 3e
An Overview of the History of Computers (continued) Although there are several categories of computers, such as mainframe, midsize, and micro, all computers share some basic elements Java Programming: From Problem Analysis to Program Design, 3e
Elements of a Computer System A computer has 2 components Hardware Software Java Programming: From Problem Analysis to Program Design, 3e
Hardware Components of a Computer Central Processing Unit (CPU) Main Memory Java Programming: From Problem Analysis to Program Design, 3e
Central Processing Unit Control Unit (CU) Arithmetic Logic Unit (ALU) Program Counter (PC) Instruction Register (IR) Java Programming: From Problem Analysis to Program Design, 3e
Java Programming: From Problem Analysis to Program Design, 3e Central Processing Unit (continued)
Main Memory Ordered sequence of cells (memory cells) Directly connected to CPU All programs must be brought into main memory before execution When power is turned off, everything in main memory is lost Java Programming: From Problem Analysis to Program Design, 3e
Main Memory with 100 Storage Cells Java Programming: From Problem Analysis to Program Design, 3e
Secondary Storage Provides permanent storage for information Examples of secondary storage: Hard Disks Floppy Disks Flash memory ZIP Disks CD-ROMs Tapes Java Programming: From Problem Analysis to Program Design, 3e
Input Devices Definition: devices that feed data and computer programs into computers Examples Keyboard Mouse Secondary Storage Java Programming: From Problem Analysis to Program Design, 3e
Output Devices Definition: devices that the computer uses to display results Examples Printer Monitor Secondary Storage Java Programming: From Problem Analysis to Program Design, 3e
Software Software consists of programs written to perform specific tasks Two types of programs System Programs Application Programs Java Programming: From Problem Analysis to Program Design, 3e
System Programs System programs   control the computer The operating system is first to load when you turn on a computer Java Programming: From Problem Analysis to Program Design, 3e
Operating System (OS) OS monitors overall activity of the computer and provides services Example services Memory management Input/output Activities Storage management Java Programming: From Problem Analysis to Program Design, 3e
Application Programs Written using programming languages Perform a specific task Run by the OS Example programs Word processors Spreadsheets Games Java Programming: From Problem Analysis to Program Design, 3e
Language of a Computer Machine language: the most basic language of a computer A sequence of 0s and 1s  Every computer directly understands its own machine language A bit is a binary digit, 0 or 1 A byte is a sequence of eight bits Java Programming: From Problem Analysis to Program Design, 3e
Language of a Computer (continued) Java Programming: From Problem Analysis to Program Design, 3e
Evolution of Programming Languages Early computers programmed in machine language Assembly languages were developed to make programmer’s job easier In assembly language, an instruction is an easy-to-remember form called a mnemonic Assembler:  translates assembly language instructions into machine language Java Programming: From Problem Analysis to Program Design, 3e
Instructions in Assembly and Machine Language Java Programming: From Problem Analysis to Program Design, 3e
Evolution of Programming Languages High-level languages   make programming easier Closer to spoken languages Examples Basic  FORTRAN COBOL C/C++ Java Java Programming: From Problem Analysis to Program Design, 3e
Evolution of Programming Languages (continued) To run a Java program Java instructions need to be translated into an intermediate language called bytecode 2. Then the bytecode is interpreted into a particular machine language  Java Programming: From Problem Analysis to Program Design, 3e
Evolution of Programming Languages (continued) Compiler:  a program that translates a program written in a high-level language into the equivalent machine language In the case of Java, this machine language is the bytecode Java Virtual Machine (JVM):  hypothetical computer developed to make Java programs machine independent Java Programming: From Problem Analysis to Program Design, 3e
A Java Program public class  ASimpleJavaProgram  {  public static void  main(String[] args)  {  System.out.println("My first Java program."); System.out.println("The sum of 2 and 3 = " + 5); System.out.println("7 + 8 = " + (7 + 8)); }  } Sample Run : My first Java program. The sum of 2 and 3 = 5 7 + 8 = 15 Java Programming: From Problem Analysis to Program Design, 3e
Processing a Java Program Two types of Java programs: applications and applets Source program:  written in a high-level language Loader:  transfers the compiled code (bytecode) into main memory Interpreter:  reads and translates each bytecode instruction into machine language and then executes it Java Programming: From Problem Analysis to Program Design, 3e
Processing a Java Program (continued) Java Programming: From Problem Analysis to Program Design, 3e
Problem-Analysis-Coding-Execution Cycle Algorithm:  a step-by-step problem-solving process in which a solution is arrived at in a finite amount of time Java Programming: From Problem Analysis to Program Design, 3e
Problem-Solving Process Analyze  the problem: outline solution requirements and design an algorithm Implement  the algorithm in a programming language (Java) and verify that the algorithm works Maintain  the program: use and modify if the problem domain changes Java Programming: From Problem Analysis to Program Design, 3e
Problem-Analysis-Coding-Execution Cycle Java Programming: From Problem Analysis to Program Design, 3e
Programming Methodologies Two basic approaches to programming design Structured design  Object-oriented design Java Programming: From Problem Analysis to Program Design, 3e
Structured Design A problem is divided into smaller subproblems Each subproblem is solved The solutions of all subproblems are then combined to solve the problem Java Programming: From Problem Analysis to Program Design, 3e
Object-Oriented Design (OOD) In OOD, a program is a collection of interacting objects An object consists of data and operations Steps in OOD Identify objects Form the basis of the solution Determine how these objects interact Java Programming: From Problem Analysis to Program Design, 3e
Chapter Summary A computer system is made up of hardware and software components Computers understand machine language; it is easiest for programmers to write in high-level languages A compiler translates high-level language into machine language Java steps to execute a program: edit, compile, load, and execute Java Programming: From Problem Analysis to Program Design, 3e
Chapter Summary (continued) Algorithm: step-by-step problem-solving process in which a solution is arrived at in a finite amount of time Three steps to problem solving: analyze the problem and design an algorithm, implement the algorithm in a programming language, and maintain the program Two basic approaches to programming design: structured and object-oriented Java Programming: From Problem Analysis to Program Design, 3e

More Related Content

PPT
9781111530532 ppt ch01
PPT
Chapter 1 - An Overview of Computers and Programming Languages
PPT
Ppt chapter 01
PPT
System software
PPT
Savitch ch 01
PPT
Savitch Ch 01
PDF
MCA-5 unit1
PPT
Software tools
9781111530532 ppt ch01
Chapter 1 - An Overview of Computers and Programming Languages
Ppt chapter 01
System software
Savitch ch 01
Savitch Ch 01
MCA-5 unit1
Software tools

What's hot (19)

PDF
Computer software and computer network
PPT
Introduction to programming languages part 2
PDF
Problem solving methodology
PPTX
Computer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika Tripathi
PPTX
Introduction to computer programming
PPTX
Computer Programming Grade 9
PPTX
Programming Fundamentals and Programming Languages Concepts
PDF
Coding principles
PPTX
Lecture 1 introduction to_computersb(2)
PPTX
System Programming
PDF
Introduction to Computer Programming
PPTX
System programming
PPT
Compilers and interpreters
PPTX
system software and application software, compiler, interpreter & assembler
PPTX
Diploma ii cfpc u-1 introduction to c language
PPTX
Mca i pic u-1 introduction to c language
PDF
++Matlab 14 sesiones
PDF
Computer memory, Types of programming languages
Computer software and computer network
Introduction to programming languages part 2
Problem solving methodology
Computer Programming By Prof.(Dr.) Anand K. Tripathi ,Mrs Monika Tripathi
Introduction to computer programming
Computer Programming Grade 9
Programming Fundamentals and Programming Languages Concepts
Coding principles
Lecture 1 introduction to_computersb(2)
System Programming
Introduction to Computer Programming
System programming
Compilers and interpreters
system software and application software, compiler, interpreter & assembler
Diploma ii cfpc u-1 introduction to c language
Mca i pic u-1 introduction to c language
++Matlab 14 sesiones
Computer memory, Types of programming languages
Ad

Viewers also liked (20)

PPT
9781111530532 ppt ch14
PPT
9781285852744 ppt ch16
PPT
Data Structures- Part2 analysis tools
PPT
Data Structures- Part9 trees simplified
PDF
AWS Innovate: AWS Container Management using Amazon EC2 Container Service an...
PPT
Data Structures- Part8 stacks and queues
PDF
Applying Design Patterns in Practice
PDF
AWS ECS Quick Introduction
PPT
Lecture 2a arrays
PPTX
Web Database
PPT
Data Structures- Part7 linked lists
PPTX
10 Sets of Best Practices for Java 8
DOC
Advanced Java - Praticals
PPTX
Java 8 Support at the JVM Level
PDF
Building Digital Transaction Systems in the new Banking World
PPTX
Coding standards for java
PPT
Data Structures- Part5 recursion
DOC
Ad java prac sol set
PDF
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
PPTX
Java 103 intro to java data structures
9781111530532 ppt ch14
9781285852744 ppt ch16
Data Structures- Part2 analysis tools
Data Structures- Part9 trees simplified
AWS Innovate: AWS Container Management using Amazon EC2 Container Service an...
Data Structures- Part8 stacks and queues
Applying Design Patterns in Practice
AWS ECS Quick Introduction
Lecture 2a arrays
Web Database
Data Structures- Part7 linked lists
10 Sets of Best Practices for Java 8
Advanced Java - Praticals
Java 8 Support at the JVM Level
Building Digital Transaction Systems in the new Banking World
Coding standards for java
Data Structures- Part5 recursion
Ad java prac sol set
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Java 103 intro to java data structures
Ad

Similar to Chap01 (20)

PPT
9781111530532 ppt ch01
PPT
Chapter 01
PPT
Introduction To Computer and Java
PPT
An overview of computers and programming languages
PPT
CISY 105 Chapter 1
PPT
01CHAP_1.PPT
PPTX
Computer program, computer languages, computer software
PPTX
Computer Programming Grade 9 for Students
PPTX
Introduction to Programming kkkkkkkkkkkkk
PPTX
Lesson 1 - Introduction to Computer Programming.pptx
PPT
Ch.01-2.ppt java[27/11, 11:00 am] Sumaya👸🏻✨️: Mida kale waqtiga wuba kudhamaa...
PDF
Introduction to computers
PDF
Overview of computers and programming
PPTX
01 Computer Basics (Ch1.1).pptx
PPTX
Lecture 1.pptx
PPTX
Chapter-introduction about java programming
PPTX
CSC201_8374838384848838e8e8r88r8r88r8.pptx
PPTX
lecture Slides - Week 1.programming fundamentals
PPTX
Chapter-4.pptx introduction to computing CC1/L
9781111530532 ppt ch01
Chapter 01
Introduction To Computer and Java
An overview of computers and programming languages
CISY 105 Chapter 1
01CHAP_1.PPT
Computer program, computer languages, computer software
Computer Programming Grade 9 for Students
Introduction to Programming kkkkkkkkkkkkk
Lesson 1 - Introduction to Computer Programming.pptx
Ch.01-2.ppt java[27/11, 11:00 am] Sumaya👸🏻✨️: Mida kale waqtiga wuba kudhamaa...
Introduction to computers
Overview of computers and programming
01 Computer Basics (Ch1.1).pptx
Lecture 1.pptx
Chapter-introduction about java programming
CSC201_8374838384848838e8e8r88r8r88r8.pptx
lecture Slides - Week 1.programming fundamentals
Chapter-4.pptx introduction to computing CC1/L

More from Terry Yoast (20)

PPT
9781305078444 ppt ch12
PPT
9781305078444 ppt ch11
PPT
9781305078444 ppt ch10
PPT
9781305078444 ppt ch09
PPT
9781305078444 ppt ch08
PPT
9781305078444 ppt ch07
PPT
9781305078444 ppt ch06
PPT
9781305078444 ppt ch05
PPT
9781305078444 ppt ch04
PPT
9781305078444 ppt ch03
PPT
9781305078444 ppt ch02
PPT
9781305078444 ppt ch01
PPTX
9781337102087 ppt ch13
PPTX
9781337102087 ppt ch18
PPTX
9781337102087 ppt ch17
PPTX
9781337102087 ppt ch16
PPTX
9781337102087 ppt ch15
PPTX
9781337102087 ppt ch14
PPTX
9781337102087 ppt ch12
PPTX
9781337102087 ppt ch11
9781305078444 ppt ch12
9781305078444 ppt ch11
9781305078444 ppt ch10
9781305078444 ppt ch09
9781305078444 ppt ch08
9781305078444 ppt ch07
9781305078444 ppt ch06
9781305078444 ppt ch05
9781305078444 ppt ch04
9781305078444 ppt ch03
9781305078444 ppt ch02
9781305078444 ppt ch01
9781337102087 ppt ch13
9781337102087 ppt ch18
9781337102087 ppt ch17
9781337102087 ppt ch16
9781337102087 ppt ch15
9781337102087 ppt ch14
9781337102087 ppt ch12
9781337102087 ppt ch11

Recently uploaded (20)

PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
master seminar digital applications in india
PDF
Classroom Observation Tools for Teachers
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Insiders guide to clinical Medicine.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
human mycosis Human fungal infections are called human mycosis..pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
master seminar digital applications in india
Classroom Observation Tools for Teachers
Pharmacology of Heart Failure /Pharmacotherapy of CHF
TR - Agricultural Crops Production NC III.pdf
01-Introduction-to-Information-Management.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Insiders guide to clinical Medicine.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Complications of Minimal Access Surgery at WLH
O7-L3 Supply Chain Operations - ICLT Program
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Microbial diseases, their pathogenesis and prophylaxis
Week 4 Term 3 Study Techniques revisited.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?

Chap01

  • 1. Java Programming: From Problem Analysis to Program Design, 3e Chapter 1 An Overview of Computers and Programming Languages
  • 2. Chapter Objectives Learn about different types of computers Explore the hardware and software components of a computer system Learn about the language of a computer Learn about the evolution of programming languages Examine high-level programming languages Java Programming: From Problem Analysis to Program Design, 3e
  • 3. Chapter Objectives (continued) Discover what a compiler is and what it does Examine how a Java program is processed Learn what an algorithm is and explore problem-solving techniques Become aware of structured and object-oriented programming design methodologies Java Programming: From Problem Analysis to Program Design, 3e
  • 4. Introduction Computers have greatly affected our daily lives – helping us complete many tasks Computer programs (software) are designed specifically for each task Software is created with programming languages Java is an example of a programming language Java Programming: From Problem Analysis to Program Design, 3e
  • 5. An Overview of the History of Computers The first device known to carry out calculations was the abacus The abacus uses a system of sliding beads on a rack for addition and subtraction Blaise Pascal invented the calculating device called the Pascaline Java Programming: From Problem Analysis to Program Design, 3e
  • 6. An Overview of the History of Computers (continued) In 1819, Joseph Jacquard, a French weaver, discovered that the weaving instructions for his looms could be stored on cards with holes punched in them In the early and mid-1800s, Charles Babbage, an English mathematician and physical scientist, designed two calculating machines—the difference engine and the analytical engine Java Programming: From Problem Analysis to Program Design, 3e
  • 7. An Overview of the History of Computers (continued) The first computer-like machine was the Mark I Built in 1944 Used punched cards to feed data into the machine 52 feet long, weighed 50 tons, and had 750,000 parts In 1946, ENIAC (Electronic Numerical Integrator and Calculator) was built at the University of Pennsylvania. Contained 18,000 vacuum tubes and weighed some 30 tons Java Programming: From Problem Analysis to Program Design, 3e
  • 8. An Overview of the History of Computers (continued) In 1956, the invention of the transistors resulted in smaller, faster, more reliable, and more energy-efficient computers This era also saw the emergence of the software development industry with the introduction of FORTRAN and COBOL, two early programming languages In 1970, the microprocessor, an entire CPU on a single chip, was invented Java Programming: From Problem Analysis to Program Design, 3e
  • 9. An Overview of the History of Computers (continued) In 1977, Stephen Wozniak and Steven Jobs designed and built the first Apple computer in their garage In 1981, IBM introduced its personal computer (PC) Modern-day computers are very powerful, reliable, and easy to use Can accept spoken-word instructions and imitate human reasoning through artificial intelligence Java Programming: From Problem Analysis to Program Design, 3e
  • 10. An Overview of the History of Computers (continued) Although there are several categories of computers, such as mainframe, midsize, and micro, all computers share some basic elements Java Programming: From Problem Analysis to Program Design, 3e
  • 11. Elements of a Computer System A computer has 2 components Hardware Software Java Programming: From Problem Analysis to Program Design, 3e
  • 12. Hardware Components of a Computer Central Processing Unit (CPU) Main Memory Java Programming: From Problem Analysis to Program Design, 3e
  • 13. Central Processing Unit Control Unit (CU) Arithmetic Logic Unit (ALU) Program Counter (PC) Instruction Register (IR) Java Programming: From Problem Analysis to Program Design, 3e
  • 14. Java Programming: From Problem Analysis to Program Design, 3e Central Processing Unit (continued)
  • 15. Main Memory Ordered sequence of cells (memory cells) Directly connected to CPU All programs must be brought into main memory before execution When power is turned off, everything in main memory is lost Java Programming: From Problem Analysis to Program Design, 3e
  • 16. Main Memory with 100 Storage Cells Java Programming: From Problem Analysis to Program Design, 3e
  • 17. Secondary Storage Provides permanent storage for information Examples of secondary storage: Hard Disks Floppy Disks Flash memory ZIP Disks CD-ROMs Tapes Java Programming: From Problem Analysis to Program Design, 3e
  • 18. Input Devices Definition: devices that feed data and computer programs into computers Examples Keyboard Mouse Secondary Storage Java Programming: From Problem Analysis to Program Design, 3e
  • 19. Output Devices Definition: devices that the computer uses to display results Examples Printer Monitor Secondary Storage Java Programming: From Problem Analysis to Program Design, 3e
  • 20. Software Software consists of programs written to perform specific tasks Two types of programs System Programs Application Programs Java Programming: From Problem Analysis to Program Design, 3e
  • 21. System Programs System programs control the computer The operating system is first to load when you turn on a computer Java Programming: From Problem Analysis to Program Design, 3e
  • 22. Operating System (OS) OS monitors overall activity of the computer and provides services Example services Memory management Input/output Activities Storage management Java Programming: From Problem Analysis to Program Design, 3e
  • 23. Application Programs Written using programming languages Perform a specific task Run by the OS Example programs Word processors Spreadsheets Games Java Programming: From Problem Analysis to Program Design, 3e
  • 24. Language of a Computer Machine language: the most basic language of a computer A sequence of 0s and 1s Every computer directly understands its own machine language A bit is a binary digit, 0 or 1 A byte is a sequence of eight bits Java Programming: From Problem Analysis to Program Design, 3e
  • 25. Language of a Computer (continued) Java Programming: From Problem Analysis to Program Design, 3e
  • 26. Evolution of Programming Languages Early computers programmed in machine language Assembly languages were developed to make programmer’s job easier In assembly language, an instruction is an easy-to-remember form called a mnemonic Assembler: translates assembly language instructions into machine language Java Programming: From Problem Analysis to Program Design, 3e
  • 27. Instructions in Assembly and Machine Language Java Programming: From Problem Analysis to Program Design, 3e
  • 28. Evolution of Programming Languages High-level languages make programming easier Closer to spoken languages Examples Basic FORTRAN COBOL C/C++ Java Java Programming: From Problem Analysis to Program Design, 3e
  • 29. Evolution of Programming Languages (continued) To run a Java program Java instructions need to be translated into an intermediate language called bytecode 2. Then the bytecode is interpreted into a particular machine language Java Programming: From Problem Analysis to Program Design, 3e
  • 30. Evolution of Programming Languages (continued) Compiler: a program that translates a program written in a high-level language into the equivalent machine language In the case of Java, this machine language is the bytecode Java Virtual Machine (JVM): hypothetical computer developed to make Java programs machine independent Java Programming: From Problem Analysis to Program Design, 3e
  • 31. A Java Program public class ASimpleJavaProgram { public static void main(String[] args) { System.out.println("My first Java program."); System.out.println("The sum of 2 and 3 = " + 5); System.out.println("7 + 8 = " + (7 + 8)); } } Sample Run : My first Java program. The sum of 2 and 3 = 5 7 + 8 = 15 Java Programming: From Problem Analysis to Program Design, 3e
  • 32. Processing a Java Program Two types of Java programs: applications and applets Source program: written in a high-level language Loader: transfers the compiled code (bytecode) into main memory Interpreter: reads and translates each bytecode instruction into machine language and then executes it Java Programming: From Problem Analysis to Program Design, 3e
  • 33. Processing a Java Program (continued) Java Programming: From Problem Analysis to Program Design, 3e
  • 34. Problem-Analysis-Coding-Execution Cycle Algorithm: a step-by-step problem-solving process in which a solution is arrived at in a finite amount of time Java Programming: From Problem Analysis to Program Design, 3e
  • 35. Problem-Solving Process Analyze the problem: outline solution requirements and design an algorithm Implement the algorithm in a programming language (Java) and verify that the algorithm works Maintain the program: use and modify if the problem domain changes Java Programming: From Problem Analysis to Program Design, 3e
  • 36. Problem-Analysis-Coding-Execution Cycle Java Programming: From Problem Analysis to Program Design, 3e
  • 37. Programming Methodologies Two basic approaches to programming design Structured design Object-oriented design Java Programming: From Problem Analysis to Program Design, 3e
  • 38. Structured Design A problem is divided into smaller subproblems Each subproblem is solved The solutions of all subproblems are then combined to solve the problem Java Programming: From Problem Analysis to Program Design, 3e
  • 39. Object-Oriented Design (OOD) In OOD, a program is a collection of interacting objects An object consists of data and operations Steps in OOD Identify objects Form the basis of the solution Determine how these objects interact Java Programming: From Problem Analysis to Program Design, 3e
  • 40. Chapter Summary A computer system is made up of hardware and software components Computers understand machine language; it is easiest for programmers to write in high-level languages A compiler translates high-level language into machine language Java steps to execute a program: edit, compile, load, and execute Java Programming: From Problem Analysis to Program Design, 3e
  • 41. Chapter Summary (continued) Algorithm: step-by-step problem-solving process in which a solution is arrived at in a finite amount of time Three steps to problem solving: analyze the problem and design an algorithm, implement the algorithm in a programming language, and maintain the program Two basic approaches to programming design: structured and object-oriented Java Programming: From Problem Analysis to Program Design, 3e