CSC 111. Solving Problems with Computers Java Programming: From Problem Analysis to Program Design, Third Edition3 Solving Problems Stages 1.Problem.

Slides:



Advertisements
Similar presentations
CS 240 Computer Programming 1
Advertisements

Solving Problems with Computers
Exercise (1).
Al-Karma Language School Computer Department Prep. 3.
PSEUDOCODE & FLOW CHART
Flow Control Analysis & Design Tool: Flowcharts
Mathematics for Computing Lecture 4: Algorithms and flowcharts Dr Andrew Purkiss-Trew Cancer Research UK
CS 240 Computer Programming 1
Chapter 1 Pseudocode & Flowcharts
Fundamentals of Algorithms MCS - 2 Lecture # 4
Chapter 2- Visual Basic Schneider
Computer Science 1620 Loops.
Developing logic (Examples on algorithm and flowchart)
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 3P. 1Winter Quarter Structured Engineering.
CHAPTER 4: ALGORITHM 4.1 Introduction stages identified in the program development process: 1. Problem analysis and specification 2. Data organization.
Review Algorithm Analysis Problem Solving Space Complexity
Algorithm & Flowchart.
Chapter 1 Pseudocode & Flowcharts
Introduction to Algorithm – part one Jennifer Elmer Form 3 Computing.
CSC141 Introduction to Computer Programming
Flowcharts.
NA2204.1jcmt CSE 1320 Intermediate Programming C Program Basics Structure of a program and a function type name (parameters) { /* declarations */ statement;
Chapter 2: General Problem Solving Concepts
EXERCISES for ALGORITHMS WRITING
Pseudocode Algorithms Using Sequence, Selection, and Repetition Simple Program Design Third Edition A Step-by-Step Approach 6.
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Basic problem solving CSC 111.
Chapter 1 Pseudocode & Flowcharts
Cosc175 - Define Problem/Design Solution/Pseudocode/Trace 1 DEFINE THE PROBLEM.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
1 Program Planning and Design Important stages before actual program is written.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
LESSON 1 Introduction to Programming Language. Computer  Comprised of various devices that are referred to as HARDWARE.  The computer programs that.
WHAT IS THIS? Clue…it’s a drink SIMPLE SEQUENCE CONTROL STRUCTURE Introduction A computer is an extremely powerful, fast machine. In less than a second,
Flowcharts C++ Lab. Algorithm An informal definition of an algorithm is: a step-by-step method for solving a problem or doing a task. Input data A step-by-step.
Computer Programming 12 Lesson 6 – Loop structure By: Dan Lunney.
Introduction to programming in java Lecture 21 Arrays – Part 1.
Chapter One Problem Solving
Program design Program Design Process has 2 phases:
GC101 Introduction to computers and programs
Introduction to Programming / chapter 3 / COM1022
Chapter One Problem Solving
GC211Data Structure Lecture2 Sara Alhajjam.
Chapter 2- Visual Basic Schneider
Computer Programming Flowchart.
Basic operations in Matlab
Algorithms An algorithm is a sequence of steps written in the form of English phrases that specific the tasks that are performed while solving the problem.It.
Lecture 2 Introduction to Programming
Introduction to Algorithm – part 1
Programming Logic n Techniques
Computational Thinking
Computational Thinking
Chapter 1 Pseudocode & Flowcharts
PROBLEM SOLVING CSC 111.
Programming Funamental slides
Pseudocode & Flowcharts
Programming Funamental slides
الفصل الثاني الخوارزمية
Chapter 2- Visual Basic Schneider
Chapter 1 Pseudocode & Flowcharts
Introduction to Algorithms and Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Faculty of Computer Science & Information System
ME 142 Engineering Computation I
My Take on the Largest Number Algorithm
Introduction to Programming
Indices my dear Watson.
Chapter 1 Pseudocode & Flowcharts
Presentation transcript:

CSC 111

Solving Problems with Computers

Java Programming: From Problem Analysis to Program Design, Third Edition3 Solving Problems Stages 1.Problem Definition  Define the main Problem

Java Programming: From Problem Analysis to Program Design, Third Edition4 Problem Definition  Write a Program to Print the Sum of two integer Numbers  Write a program to Print the Average of three integer numbers  Write a program to print the volume of a cube and the sum of it’s surfaces’ areas

Java Programming: From Problem Analysis to Program Design, Third Edition5 Solving Problems Stages 1.Problem Definition  Define the main Problem 2.Problem Analysis  Determine the inputs, outputs, Arithmetic & logic operations

Java Programming: From Problem Analysis to Program Design, Third Edition6 Problem Analysis  Write a Program to Print the Sum of two integer Numbers Inputs : 1.First Number 2.Second Number Operations :  Summation = first + second Output : 1.The summation

Java Programming: From Problem Analysis to Program Design, Third Edition7 Problem Analysis  Write a program to Print the Average of three integer numbers Inputs : 1.First Number 2.Second Number 3.Third Number Operations :  Average = (first + second + third ) / 3 Output : 1.The Average

Java Programming: From Problem Analysis to Program Design, Third Edition8 Problem Analysis  Write a program to print the volume of a cube and the sum of it’s surfaces’ areas Inputs : 1.Side Length Operations :  Volume = side * side * side  Surface area = ( side * side ) * 6 Output : 1.The Volume 2.The surface area

Java Programming: From Problem Analysis to Program Design, Third Edition9 Solving Problems Stages Problem Definition Problem Analysis Solution Design Design a solution for the problem by writing an algorithm or drawing a flow chart Algorithm Flow Chart

Java Programming: From Problem Analysis to Program Design, Third Edition10 Basic steps for designing a solution Read all the inputs Calculate operations Print the output

Java Programming: From Problem Analysis to Program Design, Third Edition11 Algorithms  Write a Program to Print the Sum of two integer Numbers 1.Start the program 2.Read the first number and save in the variable ( N1 ) 3.Read the second number and save in the variable ( N2 ) 4.Sum the both numbers and save the result in the variable ( Sum )  Sum = N1 + N2 5.Print the variable ( Sum ) 6.End the program

Java Programming: From Problem Analysis to Program Design, Third Edition12 Algorithms  Write a program to Print the Average of three integer numbers 1.Start the program 2.Read the first number and save in the variable ( num1 ) 3.Read the second number and save in the variable ( num2 ) 4.Read the third number and save in the variable ( num3 ) 5.Sum the three numbers and save the result in the variable ( result )  result = num1 + num2 + num3

Java Programming: From Problem Analysis to Program Design, Third Edition13 Algorithms  Write a program to Print the Average of three integer numbers 6.Divide the variable ( result ) by 3 and save the result in variable ( Average )  Average = result / 3 7.Print the variable ( Average ) 8.End the program

Java Programming: From Problem Analysis to Program Design, Third Edition14 Algorithms  Write a program to print the volume of a cube and the sum of it’s surfaces’ areas 1.Start the program 2.Read the length of the side and save in variable ( Length ) 3.Volume = Length * Length * Length 4.Surface = ( Length * Length ) * 6 5.Print the variable ( Volume ) 6.Print the variable ( Surface ) 7.End the program

Java Programming: From Problem Analysis to Program Design, Third Edition15 Flow Chart

Java Programming: From Problem Analysis to Program Design, Third Edition16 Loops Start/End Read/Print Arithmetic Operations Decision Connectors arrows Connectors points Comments Flow chart’s Symbols Start Read n1 N2 = 5 End Print n1 N2 = n1+3 n1 > 3 // my name

Simple Sequential Flow Charts start End

Java Programming: From Problem Analysis to Program Design, Third Edition18 Write a Program to Print the Sum of two integer Numbers 1.Start the program 2.Read the first number and save in the variable ( N1 ) 3.Read the second number and save in the variable ( N2 ) 4.Sum the both numbers and save the result in the variable ( Sum )  Sum = N1 + N2 5.Print the variable ( Sum ) 6.End the program start Read N1 Read N2 Sum = N1 + N2 Print Sum End

Java Programming: From Problem Analysis to Program Design, Third Edition19 Write a program to print the volume of a cube and the sum of it’s surfaces’ areas 1.Start the program 2.Read the length of the side and save in variable ( Length ) 3.Volume = Length * Length * Length 4.Surface = ( Length * Length ) * 6 5.Print the variable ( Volume ) 6.Print the variable ( Surface ) 7.End the program start Read L ٍSurface = ( L * L ) * 6 Print Volume End Volume = L * L * L Print Surface

Java Programming: From Problem Analysis to Program Design, Third Edition20 Write a program to Print the Average of three integer numbers start Read num1 Read num2 result = num1+num2+num3 Print Average End Read num3 Average = result/3 start Read num1,num2,num3 result = num1+num2+num3 Print Average End Average = result/3 or

Java Programming: From Problem Analysis to Program Design, Third Edition21 Write a program to Print the Average of three integer numbers start Read num1,num2,num3 Average = ( num1+num2+num3 ) / 3 Print Average End or

Java Programming: From Problem Analysis to Program Design, Third Edition22 Write a program to Print the Average of three integer numbers start Read num1 Read num2 Print Average End Read num3 Average = result/3 result = num1+num2+num3 start Read num3 Read num1 result = num1+num2+num3 Print Average End Read num2 Average = result/3

Java Programming: From Problem Analysis to Program Design, Third Edition23 Write a program to Print the Average of three integer numbers start Read num1, num2,num3 result = num1+num2+num3 Print result End Average = result/3 start Read num1, num2,num3 Print result End Average = result/3 result = num1+num2+num3 Print Average