week-02-handout

week-02-handout - 1 COMP 202 Introduction to Computing 1...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 COMP 202 Introduction to Computing 1 COMP 202 Week 2 Lets start programming Objectives : Look into simple Java program Introduce programming tools/environments Learn how to do arithmetic in Java How to output the result Approach problem Solving COMP 202 Introduction to Computing 1 COMP 202 - week 2 2 Review: Week-1 What is programming Language of programming Types of computer programs What happens when a computer starts Steps in creating your own program Text Editor, Compiler, Interpreter, Execution, IDE COMP 202 Introduction to Computing 1 COMP 202 - week 2 3 From Idea to Program Idea Text Editor Text File Interpreter Compiler Executable File Program runs internally Choices! 2 COMP 202 Introduction to Computing 1 COMP 202 - week 2 4 Problem Solving The purpose of writing a program is to solve a problem Solving problem using a computer is not always the same as solving problem using your brain Problem: Who is the tallest person in the class? Pick up the red apples from the basket What is average of your grades in Math, Science and History? COMP 202 Introduction to Computing 1 COMP 202 - week 2 5 Problem Solving The general steps in problem solving are: Understand the problem Dissect the problem into manageable pieces Design a solution Consider alternatives to the solution and refine it Implement the solution Test the solution and fix any problems that exist COMP 202 Introduction to Computing 1 COMP 202 - week 2 6 Problem Solving Many software projects fail because the developer didn't really understand the problem to be solved We must avoid assumptions and clarify ambiguities As problems and their solutions become larger, we must organize our development into manageable pieces This technique is fundamental to software development 3 COMP 202 Introduction to Computing 1 COMP 202 - week 2 7 Example Problem Problem- 1: You want to buy an MP3 player. Actual price is $100. Shop A gives you $25 instant rebate. Shop B gives you $30 mail- in rebate. You have to pay 15% sales tax in both cases. In case of mail- in rebate, you pay tax on full amount, but get return the rebate amount without tax. Which one is a better deal? How to write a program to compute the result of these two rebates? 3 values are given as input: total_price, instant_rebate_amount, mail_in_rebate_amount . COMP 202 Introduction to Computing 1 COMP 202 - week 2 8 Example Problem Problem-2: Assume you have a robot that can do the following actions: take-a-step, turn- left, turn-right, is-wall?, is-box?, start, and stop. The robot is in a square room with no furniture. There is a single box adjacent to a wall. Robots objective is to stop beside the box. The robot starts at a random position....
View Full Document

Page1 / 20

week-02-handout - 1 COMP 202 Introduction to Computing 1...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online