Download presentation

Presentation is loading. Please wait.

Published byMireya Coleman Modified over 3 years ago

1
© 2004 Pearson Addison- Wesley. All rights reserved 1-1 1434-1435 هـ Instructor: programming1- Introduction to Object Oriented Programming

2
© 2004 Pearson Addison- Wesley. All rights reserved 1-2 programming1- Syllabus Course Objectives: programming1- is a first course in Java for computer science majors. Topics include : an overview of the Java programming language, problem solving program design, implementation, and testing Object-Oriented concepts: such as Classes, objects, encapsulation, inheritance, polymorphism Simple Java Data Structures. Recursion.

3
© 2004 Pearson Addison- Wesley. All rights reserved 1-3 Times & Location: Lectures: Labs: Course Material: Textbook:, Name: :Java How to Program, 9th edition - Authors: Paul Dietel, Harvey Dietel OTHER MATERIALS: o Name: JAVA SOFTWARE SOLUTION,FOUNDATION OF PROGRAM DESIGN, FOURTH EDITION Authors: John Lewis, Villanova University William Loftus, Gestalt, LLC Publisher: Addison-Wesley – ISBN: 0-321-32203-7 programming1- Syllabus

4
o Name: problem solving - Authors : Sony Slides: will be posted on the BLOG before each lecture © 2004 Pearson Addison- Wesley. All rights reserved1-4

5
© 2004 Pearson Addison- Wesley. All rights reserved 1-5 programming1- Syllabus Office hours: Saturday Sunday Monday Tuesday Other : By appointment & by email Grading Policy : 10% Exam1 10% Exam2 30% Lab: Exercises & Attendance & Quizzes 10% Programming Assignments 40% Final exam Communication Policy: apply to join the class group at : BLOG OF SUBJECT : CCIS141.WORDPRESS.COM CCIS141.WORDPRESS.COM &BLACKBOARD

6
© 2004 Pearson Addison- Wesley. All rights reserved 1-6 Coursework Reading. Students are responsible for reading and understanding the material in the textbook. However, we will not necessarily cover all of it in class. If you do not understand something in the book, there will be opportunity to ask questions in class, during your teachers' office hours. Programming: There will be a lab programming exercises which will be given in the lab and due the next lab period. Also there will be programming assignments which you will do at home. Due Dates: Labs are due the next lab period. Programming assignments will be due the assigned date. programming1- Syllabus

7
© 2004 Pearson Addison- Wesley. All rights reserved 1-7 Coursework Late work. Late labs will not be accepted. Late projects will be penalized 10 points a day. Missing an Exam or Contesting a grade. Once labs or projects grades are given to you, you have one week to contest the grade. After that the grade will not be changed. You must have a written excuse (doctor's note, for example) to miss an exam. Once a test or quiz is returned, you have one week to contest the grade beyond that the grade will not be changed. Note that the week starts when a test is returned to the class, which may or may not be when you choose to pick yours up. programming1- Syllabus

8
© 2004 Pearson Addison- Wesley. All rights reserved 1-8 Software: For you to program at home, you will need to : http://java.sun.com/j2se/1.5.0/download.jsp http://java.sun.com/j2se/1.5.0/download.jsp download The Java 2 Standard Edition 5.0 (J2SE),go to http://java.sun.com/j2se/1.5.0/download.jsp to download : http://java.sun.com/j2se/1.5.0/download.jsp The J2SE Development Kit (JDK) which supports creating J2SE applications, the "Java Runtime Enabler" (JRE) is not sufficient. J2SE 5.0 Documentation, includes the API specification for J2SE which will help during the java application development. JDK 5.0 Source Code, includes useful java programs to write, compile & run java programs download on of the folwoing Integrated Development Environment (IDE): Jgrasp http://spider.eng.auburn.edu/user- cgi/grasp/grasp.pl?;dl=download_jgrasp.htmlhttp://spider.eng.auburn.edu/user- cgi/grasp/grasp.pl?;dl=download_jgrasp.html Jcreator http://www.jcreator.com/download.htmhttp://www.jcreator.com/download.htm NetBeans. programming1- Syllabus

9
© 2004 Pearson Addison- Wesley. All rights reserved 1-9 Software-cont.: other helpful downloads: The Java Language Specification, Third Edition http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html The Java tutorial http://java.sun.com/docs/books/tutorial/index.html http://java.sun.com/docs/books/tutorial/index.htmlLabs: Lab time will be your opportunity to: become accustomed to the CS department computing environment Learn how to use the IDE: how to compile and run your java program. gain an introduction and ask questions about labs and programming assignments Lab attendance is required. Failure to attend lab will result in significant loss of both instruction and hands-on experience. In addition, quizzes or in-lab assignments may not be made up. programming1- Syllabus

10
© 2004 Pearson Addison- Wesley. All rights reserved 1-10 Labs-cont.: During lab time, your lab instructor will provide examples and assistance with concepts covered in the book and during lecture, and occasionally will introduce new material as well. you should fully prepare yourself for lab by attending lectures and completing any assigned reading, as well as carefully reviewing and, in appropriate cases, getting started on the lab assignments provided in advance. Lab will also provide the opportunity to ask more detailed questions than may be possible during your lecture. Lab assignments will be given in the lab and are due next lab. Please note that you must attend the lab session you are registered for. All quizzes in the course will be given in labs. They will not be announced beforehand. programming1- Syllabus

11
© 2004 Pearson Addison- Wesley. All rights reserved 1-11 Programming Policy Working With Others These are to be individual efforts, meaning that no code sharing or discussion of problem solutions with anyone except your instructor. You may not incorporate code written by others, such as can be found on the Internet or any of the numerous CS books. During a lab session, you are not Allowed to let another student to copy your work or to copy that of another student. Other Policies Programming assignments may be weighted differently. Documentation is required. You will be given credit only for code that works. This means that you should code and test functions as you write them, not code the whole thing and then try to get it to work, you may get partial grade for non working code if it is logically correct. Submitted projects must run on NETBEANS. programming1- Syllabus

13
This chapter will cover the following topics: Problem Solving Concepts for the Computer Pre-Programming Phase Programming Or Implementation Phase

14
What Problem Can Be Solved By Computer When the solution can be produced by a set of step-by-step procedures or actions. This step-by-step action is called an algorithm. The algorithm will process some inputs and produced output. Solving problem by computer undergo two phases: Phase 1: Organizing the problem or pre-programming phase. Phase 2: Programming phase.

15
PRE-PROGRAMMING PHASE This phase requires five steps: 1. Analyzing the problem - PAC 2. Developing the Hierarchy Input Process Output (HIPO) chart or Interactivity Chart (IC). 3. Developing the Input-Process-Output (IPO) Chart. 4. Drawing the Program flowcharts. 5. Writing the algorithms.

16
PRE-PROGRAMMING PHASE 1. Analyzing The Problem Understand and analyze the problem to determine whether it can be solved by a computer. Analyze the requirements of the problem. Identify the following: Data requirement. Processing requirement or procedures that will be needed to solve the problem. The output.

17
PRE-PROGRAMMING PHASE All These requirements can be presented in a Problem Analysis Chart (PAC) DataProcessingOutput given in the problem or provided by the user List of processing required or procedures. Output requirement.

18
PRE-PROGRAMMING PHASE Example: Payroll Problem Calculate the salary of an employee who works by hourly basis. The formula to be used is Salary = Hour works * Pay rate DataProcessingOutput Hours work, Pay rate Salary = Hours work * payrateSalary

19
Problem 1 Write a Problem Analysis Chart (PAC) to convert the distance in miles to kilometers where 1.609 kilometers per mile. DataProcessingOutput Distance in miles Kilometers = 1.609 x miles Distance in kilometers

20
Problem 2 Write a Problem Analysis Chart (PAC) to find an area of a circle where area = pi * radius * radius DataProcessingOutput radiusarea = 3.14 x radius x radiusarea

21
Problem 3 Write a Problem Analysis Chart (PAC) to compute and display the temperature inside the earth in Celsius and Fahrenheit. The relevant formulas are Celsius = 10 x (depth) + 20 Fahrenheit = 1.8 x (Celsius) + 32 DataProcessingOutput depthcelsius = 10 x (depth) + 20 fahrenheit = 1.8 x (celsius) + 32 Display celsius, Display fahrenheit

22
Problem 4 Write a problem analysis chart (PAC) that asks a user to enter the distance of a trip in miles, the miles per gallon estimate for the users car, and the average cost of a gallon of gas. Calculate and display the number of gallons of gas needed and the estimated cost of the trip.

23
DataProcessingOutput distance, miles per gallon, cost per gallon gas needed = distance / miles per gallon. estimated cost = cost per gallon x gas needed Display gas needed Display estimated cost

24
Extra Problem Write a problem analysis chart (PAC) that asks a user to enter a unit price and quantity of the product sold. Calculate and display the total sale

25
PRE-PROGRAMMING PHASE Developing the Hierarchy Input Process Output (HIPO) or Interactivity Chart (IC) The problem is normally big and complex. Thus, requires big program. Thus, the processing can be divided into subtasks called modules. Each module accomplishes one function. These modules are connected to each other to show the interaction of processing between the modules.

26
PRE-PROGRAMMING PHASE Main/control module controls the flow all other modules. The IC is developed using top-down-method: top to down left to right order (also refer to order of processing). Modules are numbered, marked for duplication, repetition or decision.

27
PRE-PROGRAMMING PHASE The interaction will form a hierarchy, called Hierarchy Input Process Output Chart (HIPO) or Interactivity Chart (IC). Programming which use this approach (problem is divided into subtasks) is called Structured Programming. Main Module Module 3Module 2 Module 1 Module 5Module 4Module 6

28
PRE-PROGRAMMING PHASE PAYROLL 0000 READ 1000 PRINT 3000 CALCULATE 2000

29
PRE-PROGRAMMING PHASE Example 2.2: Extended Payroll Problem You are required to write a program to calculate both the gross pay and the net pay of every employee of your company. To determine the gross pay, you have to multiply the accumulated total hours worked by the employee, by the appropriate pay rate. The program should print the cheque that tells the total net pay. The net pay is calculated by subtracting the gross pay with any deductions that may be incurred by the employee.

30
PRE-PROGRAMMING PHASE Accumulate Hourly Worked 1100 Payroll 0000 Calculate Gross Pay 1000 Determine Pay rate 1200 Write Cheque 3000 Calculate Net Pay 2000 Calculate Deductions 2100

31
Problem 1 Write a Hierarchy Input Process Output (HIPO) to convert the distance in miles to kilometers where 1.609 kilometers per mile. Convert the distance 0000 Distance in miles 1000 Kilometers = 1.609 x miles 2000 Distance in Kilometers 3000

32
Problem 2 Write a Hierarchy Input Process Output (HIPO) to find an area of a circle where area = pi * radius * radius Area 0000 radius 1000 area = 3.14 x radius x radius 2000 Display area 3000

33
Problem 3 Write a Hierarchy Input Process Output (HIPO) to compute and display the temperature inside the earth in Celsius and Fahrenheit. The relevant formulas are Celsius = 10 x (depth) + 20 Fahrenheit = 1.8 x (Celsius) + 32 Temperature 0000 Calculate temperature in celsius 1000 Calculate temperature In fahrenheit 2000 Display Temperature 3000 Get depth 1100

34
Problem 4 Write a Hierarchy Input Process Output (HIPO) that asks a user to enter the distance of a trip in miles, the miles per gallon estimate for the users car, and the average cost of a gallon of gas. Calculate and display the number of gallons of gas needed and the estimated cost of the trip.

35
Estimation Cost 0000 Calculate gas Needed 1000 Calculate estimated Cost 2000 Display gas needed Display estimated Cost 3000 Get total distance in miles 1100 Get miles per gallon 1200 Get average cost per gallon 2100

36
Extra Problem Extended Extra Problem Find the total sale if the customer is given 20% discount on the sale items

37
PRE-PROGRAMMING PHASE Developing the Input Process Output (IPO) Chart Extends and organizes the information in the Problem Analysis Chart. It shows in more detail what data items are input, what are the processing or modules on that data, and what will be the result or output. It combines information from PAC and HIPO Chart.

38
PRE-PROGRAMMING PHASE InputProcessingModuleOutput All input data from PAC All processing steps from HIPO / IC Module reference from the IC All output requirements from PAC IPO Chart

39
PRE-PROGRAMMING PHASE InputProcessingModuleOutput -Hours Worked -Pay Rate -Deduction -Enter Hourly Worked -Enter Pay Rate -Calculate Gross Pay -Enter Deductions -Calculate Net Pay -Print Cheque -End 1100 1200 1000 2100 2000 3000 0000 -Net pay IPO for Extended Payroll Problem

40
Problem 1 InputProcessingModuleOutput -Distance in Miles-Enter distance -Kilometers = 1.609 x distance -Display kilometers 1000 2000 3000 -Distance in kilometers Write a Input Process Output (IPO) to convert the distance in miles to kilometers where 1.609 kilometers per mile.

41
Problem 2 InputProcessingModuleOutput - radius- Enter radius - area = 3.14 x radius x radius -Display area -end 1000 2000 3000 0000 - Area of a circle Write a Input Process Output (IPO) to find an area of a circle where area = pi * radius * radius

42
Problem 3 Write an Input Process Output (IPO) to compute and display the temperature inside the earth in Celsius and Fahrenheit. The relevant formulas are Celsius = 10 x (depth) + 20 Fahrenheit = 1.8 x (Celsius) + 32

43
Problem 4 Write an Input Process Output (IPO) that asks a user to enter the distance of a trip in miles, the miles per gallon estimate for the users car, and the average cost of a gallon of gas. Calculate and display the number of gallons of gas needed and the estimated cost of the trip.

44
InputProcessingModuleOutput - Distance in miles - Miles per gallon - Cost gas per gallon - Enter distance - Enter miles per gallon - Calculate total gas needed - Enter cost gas per gallon - Calculate estimated cost - Display total gas and estimated cost - End 1100 1200 1000 2100 2000 3000 0000 -Total gas needed - Estimated cost

45
Extra Problem Extended Extra Problem Write a IPO chart that asks a user to enter a unit price and quantity of the product sold. Calculate and display the total sale Find the total sale if the customer is given 20% discount on the sale items.

Similar presentations

Presentation is loading. Please wait....

OK

Data Structures and Algorithms in Java AlaaEddin 2012.

Data Structures and Algorithms in Java AlaaEddin 2012.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google