CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 3: September 5-9, 2011 Aditya Mathur Department of Computer Science Purdue.

Slides:



Advertisements
Similar presentations
CS 180 Problem Solving and Object Oriented Programming Spring 2011 February 16, 2011 Aditya Mathur Department of Computer Science Purdue University West.
Advertisements

CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 5: September 19-23, 2011 Aditya Mathur Department of Computer Science Purdue.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 13: Nov 14-18, 2011 Aditya Mathur Department of Computer Science Purdue.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 10: Oct 24-28, 2011 Aditya Mathur Department of Computer Science Purdue.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 8: Oct 10-14, 2011 Aditya Mathur Department of Computer Science Purdue.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 4: September 12-16, 2011 Aditya Mathur/Tim Korb Department of Computer.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 13: Nov 15-19, 2010 Aditya Mathur Department of Computer Science Purdue.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 16: Dec 6-10, 2010 Aditya Mathur Department of Computer Science Purdue.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 9: Oct 17-21, 2011 Aditya Mathur Department of Computer Science Purdue.
CS 178: Programming with Multimedia Objects Aditya P. Mathur Professor of Computer Sciences Purdue University, West Lafayette Sept 9, 2004 Last update:
Welcome to Introduction to Java Programming At J.D.O’Bryant Science & Mathematics Chonho Lee Department of Computer Science University of Massachusetts.
CS101- Lecture 11 CS101 Fall 2004 Course Introduction Professor Douglas Moody –Monday – 12:00-1:40 – – –Web Site: websupport1.citytech.cuny.edu.
CS 178: Programming with Multimedia Objects Aditya P. Mathur Professor of Computer Sciences Purdue University, West Lafayette Sept 20, 2004 Last update:
CSC 171 – FALL 2004 COMPUTER PROGRAMMING LECTURE 0 ADMINISTRATION.
COMP 110 Introduction to Programming Mr. Joshua Stough August 22, 2007 Monday/Wednesday/Friday 3:00-4:15 Gardner Hall 307.
Using MyMathLab Features You must already be registered or enrolled in a current MyMathLab class in order to use MyMathLab. If you are not registered or.
Computer Science 102 Data Structures and Algorithms V Fall 2009 Lecture 1: administrative details Professor: Evan Korth New York University 1.
How To Prepare For Your First Online Class By Jeannie Tipton Let’s Begin!
CPS 2231 Computer Organization and Programming Instructor: Tian (Tina) Tian.
7-Sep-15 Physics 1 (Garcia) SJSU Conceptual Physics (Physics 1) Prof. Alejandro Garcia Spring 2007.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 11: Oct 31-Nov 4, 2011 Aditya Mathur Department of Computer Science Purdue.
1 HCC Brandon Independent Study Orientation Power Point Instructor: Tiffany Cantrell.
Welcome to CS 3260 Dennis A. Fairclough. Overview Course Canvas Web Site Course Materials Lab Assignments Homework Grading Exams Withdrawing from Class.
Lecture 1 Page 1 CS 111 Summer 2015 Introduction CS 111 Operating System Principles.
MGS 351 Introduction to Management Information Systems
How to be an online student. How does it work? An online course follows a schedule and syllabus with due dates for assignments (just like an on-campus.
COMP 171: Principles of Computer Science I John Barr.
MATSE 081: MATERIALS IN TODAY’S WORLD The book is mandatory, and may be bought from the PSU Bookstore on campus, or from the bookstore downtown. The book.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 3: September 6-10, 2010 Aditya Mathur Department of Computer Science Purdue.
CSCI 51 Introduction to Computer Science Dr. Joshua Stough January 20, 2009.
Introduction to Databases Computer Science 557 September 2007 Instructor: Joe Bockhorst University of Wisconsin - Milwaukee.
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
Game Design LIVE Class Session 01/12/2012. Agenda for LIVE Class Weekly road map Review of basic course information Review of key course information and.
Principles of Financial Accounting I Fall Semester 2007 Orientation Welcome – We are glad you are here! Let’s look at the syllabus for this course.
Introduction to Data Structures
CS2910 Week 1, Class 3 Today Lab 1 – Additional Assignment Working Ahead Primitives in Java SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder.
IT Semester 1 Course Introduction IT Portfolio IT 1140 ( Semester 1) Hong Kong Baptist University IT 1140 – IT Portfolio – Course Introduction.
Lecture 1 Page 1 CS 111 Summer 2013 Introduction CS 111 Operating System Principles Peter Reiher.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 5: September 20-24, 2010 Aditya Mathur Department of Computer Science Purdue.
CS 178: Programming with Multimedia Objects Aditya P. Mathur Professor of Computer Sciences Purdue University, West Lafayette August 25, 2004 Last update:
Using MyMathLab Features of MyMathLab You must already be registered or enrolled in a current MyMathLab class in order to use MyMathLab. If you are not.
Introduction Fall 2001 Foundations of Computer Systems Prerequisite:91.166* or * Section A Instructor: Dr. David Hutchinson Office:
INTRODUCTION TO PROGRAMMING ISMAIL ABUMUHFOUZ | CS 146.
CS 139 – Algorithm Development MS. NANCY HARRIS LECTURER, DEPARTMENT OF COMPUTER SCIENCE.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 11: Nov 1-5, 2010 Aditya Mathur Department of Computer Science Purdue University.
CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 14: Nov 21-25, 2011 Aditya Mathur Department of Computer Science Purdue.
CS 178: Programming with Multimedia Objects Aditya P. Mathur Professor of Computer Sciences Purdue University, West Lafayette August 27, 2004 Last update:
MGS 351 Introduction to Management Information Systems Lecture #1.
Welcome to Astronomy 113 “ It would seem that you have no useful skill or talent whatsoever, he said.
ITK 168 Structured Problem-Solving Using the Computer Fall, 2006.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 9: Oct 18-22, 2010 Aditya Mathur Department of Computer Science Purdue.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 10: Oct 25-29, 2010 Aditya Mathur Department of Computer Science Purdue.
1 CS 4396 Computer Networks Lab General Info. 2 Goal: This course aims at helping students get more insight into how the Internet works and gain hands.
08/29/2006 Introduction INTRODUCTION Instructor: Petru S. Fodor Class webpage: PHYSICS 243H.
CS 122 Engineering Computation Lab Lab1 Bruce Char Department of Computer Science Drexel University Summer 2009 ©By the author. All rights reserved. Permission.
PROBLEM SOLVING AND PROGRAMMING ISMAIL ABUMUHFOUZ | CS 170.
Computer Science I ISMAIL ABUMUHFOUZ | CS 180. CS 180 Description BRIEF SUMMARY: This course covers a study of the algorithmic approach and the object.
CS 180 Problem Solving and Object Oriented Programming Fall 2010 Notes for Week 6: September 27-Oct 1, 2010 Aditya Mathur Department of Computer Science.
Computer Engineering Department Islamic University of Gaza
It’s called “wifi”! Source: Somewhere on the Internet!
CSE 116/504 – Intro. To Computer Science for Majors II
CS 1111 Introduction to Programming Fall 2018
Computer Engineering Department Islamic University of Gaza
CS Problem Solving and Object Oriented Programming Spring 2019
CS Problem Solving and Object Oriented Programming Spring 2019
CS Problem Solving and Object Oriented Programming Spring 2019
CS Problem Solving and Object Oriented Programming Spring 2019
CS Problem Solving and Object Oriented Programming Spring 2019
CS Problem Solving and Object Oriented Programming Spring 2019
CS Problem Solving and Object Oriented Programming Spring 2019
Presentation transcript:

CS 180 Problem Solving and Object Oriented Programming Fall 2011 Notes for Week 3: September 5-9, 2011 Aditya Mathur Department of Computer Science Purdue University West Lafayette, IN, USA This week: 1.Quiz 2.Questions/Review 3.Writing simple programs to solve simple problems

Readings and Self-help Exercises for Week 3 Readings: Chapter 3: 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 Self help Exercises [Not to be turned in]: 3.1, 3.2, 3.3, 3.7, 3.8, ©Aditya Mathur. CS 180. Fall Week 39/7/2011

Announcements 3©Aditya Mathur. CS 180. Fall Week 39/7/2011 Feast with faculty: To resume on September 14. Monday lecture by Dr Korb. Type conversions and handling strings. Project 1 deadline Friday September 23, 201. Late submission is not in your best interest. Programs in the textbook are now available for you to download and play with. Go to the course web site and click on the link marked Textbook Programs

Programming Competition 4©Aditya Mathur. CS 180. Fall Week 39/7/2011 Winning team gets a free: Please send me mail to register. I need names of the team members and of the team leader.

Questions? Frequency Code for your iClicker: AA 5©Aditya Mathur. CS 180. Fall Week 39/7/2011

Quiz 6©Aditya Mathur. CS 180. Fall Week 39/7/2011

Q1. The value of a will be 0 after which one of the following assignments? (a) float a=(float)1/2; (b) float a=1/2; (c ) int a=1/2; 7©Aditya Mathur. CS 180. Fall Week 39/7/2011 Correct answer: c

Q2. Which one of the following is not a primitive type in Java? (a)int (b)Float (c)float (d)double 8©Aditya Mathur. CS 180. Fall Week 39/7/2011 Correct answer: b

Q3. What is the value of the expression 7%2? (a)1 (b)0 (c)2 (d)3 9©Aditya Mathur. CS 180. Fall Week 39/7/2011 Correct answer: a

Q4. Given int a=4; what is the value of the expression a<<2? (a)8 (b)16 (c)32 (d)64 10©Aditya Mathur. CS 180. Fall Week 39/7/2011 Correct answer: b

Let us write a simple Java program: The problem 11©Aditya Mathur. CS 180. Fall Week 39/7/2011 Write a Java program to compute the net sale in dollars given the price of each ticket in dollars and the number of tickets sold. Assume that a randomly selected discount of between 3 to 7% is given on any sale.

Problem: Understanding 12©Aditya Mathur. CS 180. Fall Week 39/7/2011 This is an easy problem!

Problem: Design of solution 13©Aditya Mathur. CS 180. Fall Week 39/7/2011 Keep this step independent of Java! Step 1: Get data [price of a ticket and total tickets sold] Step 2: Compute total sale[multiply the items input] Step 3: Find discount to be given [3 to 7%] Step 4: Compute discounted sale price [=total sale-(total sale*discount)]. Step 5: Display the discounted sale price.

Problem: Refine solution: Get data 14©Aditya Mathur. CS 180. Fall Week 39/7/2011 Keep this step independent of Java! Step 1.1: Prompt for price Step 1.2: Read price Step 1.3: Prompt for number of tickets sold Step 1.4: Read number of tickets sold

Problem: Refine solution: Compute total sale 15©Aditya Mathur. CS 180. Fall Week 39/7/2011 Keep this step independent of Java! Step 2: Compute Total sale=price of a ticket * number of tickets sold

Problem: Refine solution: Compute discount 16©Aditya Mathur. CS 180. Fall Week 39/7/2011 Keep this step independent of Java! Step 3: Generate a random number (say, r) between 0 and 1 and convert this to a number (say, d) between 3 and 7. d=mr+c [Remember the straight line y=mx+c?] d r m= ? c= ?

Problem: Refine solution: Compute discounted price 17©Aditya Mathur. CS 180. Fall Week 39/7/2011 Keep this step independent of Java! Step 4: Compute discounted price= total price-(total price*discount)

Problem: Refine solution: Display discounted price 18©Aditya Mathur. CS 180. Fall Week 39/7/2011 Keep this step independent of Java! Step 5: Display discounted price (as easy as that!!).

Code the solution in Java. Test it. 19©Aditya Mathur. CS 180. Fall Week 39/7/2011

Week 3: September 5-9, 2011 Hope you enjoyed this week! Questions? Contact your recitation instructor. Make full use of our office hours. 20©Aditya Mathur. CS 180. Fall Week 39/7/2011