CS1010: Programming Methodology

Slides:



Advertisements
Similar presentations
Write a program step by step. Step 1: Problem definition. Given the coordinate of two points in 2-D space, compute and print their straight distance.
Advertisements

CS1010 Programming Methodology
CS1101: Programming Methodology
LECTURE 1 CMSC 201. Overview Goal: Problem solving and algorithm development. Learn to program in Python. Algorithm - a set of unambiguous and ordered.
Introduction to Computer Programming in C
Welcome and Administrative Matters.
CS1010 Programming Methodology
School of Computing Science – CMT1000 Slide 1 Ed Currie Introduction to Programming CMT1000 Lecture 1A.
UNIT 7 Testing and Debugging.
CS1101: Programming Methodology Aaron Tan.
COMPSCI 101 S Principles of Programming Lecture 1 – Introduction.
Writing a Program Chapter 1. Introduction We all “start” by learning how to code in some programming language. –With a small, hypothetical, and fairly.
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
CS1104: Computer Organisation Welcome (AY2006/7 Semester 2)
CSCI 1301 Principles of Computer Science I
EECE 310 Software Engineering Lecture 0: Course Orientation.
Introduction to Programming Lecture 1 – Overview
Welcome and Administrative Matters Lecturer’s slides.
CS1010: Programming Methodology
CS 140 Computer Programming (I) Second semester (3 credits) Imam Mohammad bin Saud Islamic University College of Computer Science and Information.
WEEK 4 Class Activities Lecturer’s slides.
CS1101: Programming Methodology Aaron Tan.
CS1010: Programming Methodology
CPSC 121: Models of Computation Unit 0 Introduction George Tsiknis Based on slides by Patrice Belleville and Steve Wolfman.
Principles of Computer Science I Honors Section Note Set 1 CSE 1341 – H 1.
CSC 221: Computer Programming I Fall 2001 course overview  what did we set out to learn?  what did you actually learn?  where do you go from here? 
Week 6.  Lab 1 and 2 results  Common mistakes in Style  Lab 1 common mistakes in Design  Lab 2 common mistakes in Design  Tips on PE preparation.
Week 1 Tutorial: Foundation Mathematics for Business Statistics
CS1101: Programming Methodology
CS-112 Object Oriented Concepts Course Syllabus. Outline  Instructor and Prerequisites  What this course is  Learning outcomes  Degree program outcomes.
EGR 115 Introduction to Computing for Engineers Branching & Program Design – Part 1 Monday 29 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Structured Programming (4 Credits)
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2003 Mr. Frey (0101 – 0104) Mr. Raouf (0201 – 0204)
CS1101: Programming Methodology Preparing for Practical Exam (PE)
COMP1927 Course Introduction 16x1
CS 162 Introduction to Computer Science II Winter, 2014: 60 Spring, 2014: 60 Summer, 2014: 71.
CS1020 Data Structures and Algorithms I Lecture Note #0 Course Admin (AY2015/6 Semester 2)
Textbook C for Scientists and Engineers © Prentice Hall 1997 Available at NUS CO-OP at S$35.10.
WEEK 1 Class Activities.
CSC 205 Java Programming II Introduction. Topics Syllabus Course goals and approach Review I Java language fundamentals.
CS1101: Programming Methodology Preparing for Practical Exam (PE)
Welcome and Administrative Matters Lecturer’s slides.
CS1101: Programming Methodology
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
CS 161 Introduction to Computer Science I Winter, 2014: 112 Spring, 2014: 131 Summer, 2014: 132.
Principles of Imperative Computation Lecture 1 January 15 th, 2012.
CS1010: Programming Methodology
XuanTung Hoang 1 Something to discuss Feedbacks on Midterm Exam Final exam and term project  Final exam requires solid knowledge/skills in Java  Be more.
1 Week 1 Introduction, Writing a Program, Building a System Software Engineering Fall Term 2015 Marymount University School of Business Administration.
WEEK 1 Class Activities.
Course Work 2: Critical Reflection GERALDINE DORAN B
CS140 – Computer Programming 1 Course Overview First Semester – Fall /1438 – 2016/2017 CS140 - Computer Programming 11.
Computer Engineering Department Islamic University of Gaza
Exam #1 You will have exactly 30 Mins to complete the exam.
CS1010 Programming Methodology
CS1010 Programming Methodology
CS1010 Programming Methodology
Topic: Introduction to Computing Science and Programming + Algorithm
It’s called “wifi”! Source: Somewhere on the Internet!
CS2100 Computer Organisation
CS1010 Programming Methodology
Week 1 Tutorial: Foundation Mathematics for Business Statistics
CS1010: Programming Methodology Preparing for Practical Exam (PE)
EECE 310 Software Engineering
Introduction to Programming Using C++
Computer Engineering Department Islamic University of Gaza
Pharmacy 429 Final Lab Exam November 19, 2002
Programming Fundamentals Lecture #1 Overview of Computer Programming
CS144K An Introduction to Computer Networks
Presentation transcript:

CS1010: Programming Methodology

Workshop Overview 2 25 July 2014 Introduction to Computer Programming (L1 & L2) Variables and Operators Basic Input/Output Control Flow Basic Testing and Debugging Problem Solving with Algorithmic Thinking (L3 & L4) Introduction to Programming Language Programming Language Specific Topics Programmin g language specific syllabus Common syllabus

Introduction to Computer Programming (L1 & L2) Variables and Operators Basic Input/Output Control Flow Basic Testing and Debugging Problem Solving with Algorithmic Thinking (L3 & L4) Introduction to Programming Language Programming Language Specific Topics CS1010 Syllabus 3 25 July 2014

Module Website 4 25 July

IVLE 5 25 July 2014  Watch out for announcements Participate in the forums Multimedia videos

Description and Objectives 6 25 July 2014 Introduces the fundamental concepts of problem solving by computing and programming using an imperative programming language. Outcomes Solve simple algorithmic problems Write good small programs C as a tool Not just about C

Skills 7 25 July 2014 Language constructs Problem solving Coding

Workload  Lectures:  3 hours/week in a lab setting  Discussion sessions:  2 hours/week from week 3 in a lab setting  Continual assessments:  Take-home lab assignments  2 Practical Exams  Term Test  Final Exam  Refer to module website July 2014

What to prepare? 9 25 July 2014 Check out CS1010 website Read document “Intro Workshop: Getting Started with UNIX and CodeCrunch) ( Learn UNIX Learn vim

Taxi Fare (1/4) The taxi fare structure in Singapore must be one of the most complex in the world! See Write a program Week4_TaxiFare.c that reads the following input data (all are of int type) from the user, and computes the taxi fare:  dayType: 0 represents weekends and public holidays (PH for short); 1 represents weekdays and non-PH  boardHour, boardMin: the hour and minute the passengers board the taxi (eg: if the passengers board the taxi at 2:27 PM)  distance: the distance of the journey, in metres Your program should have a function float computeFare(int dayType, int boardTime, int distance)  The parameter boardTime is converted from the input data boardHour and boardMin. It is the number of minutes since 0:00hr. Eg: If boardHour and boardMin are 14 and 27 respectively, then boardTime is July

Taxi Fare (2/4) To implement the actual taxi fare could be a PE question. In this exercise, we use a (grossly) simplified fare structure:  Basic Fare:  Surcharge (applicable at the time of boarding): Flag-down (inclusive of 1 st km or less)$3.40 Every 400m thereafter or less up to 10.2km$0.22 Every 350m thereafter or less after 10.2km$0.22 dayTypeMidnight charge (12am – 5:59am) Peak hour charge (6am – 9:29am) Peak hour charge (6pm – 11:59pm) 0: Weekends & PH50% of metered fare None25% of metered fare 1: Weekdays and non-PH 50% of metered fare 25% of metered fare 25 July

Taxi Fare (3/4) You are given an incomplete program Week4_TaxiFarePartial.c. Complete the program. This exercise is mounted on CodeCrunch. Sample runs below for your checking Day type: 0 Boarding hour and minute: Distance: Total taxi fare is $9.12 First 1km: $3.40 Next 9.2km: 23  $0.22 = $5.06 Next 750m: 3  $0.22 = $0.66 Basic fare = $9.12 No surcharge Total fare = $9.12 Day type: 1 Boarding hour and minute: 9 20 Distance: 6123 Total taxi fare is $7.83 First 1km: $3.40 Next 5123m: 13  $0.22 = $2.86 Basic fare = $6.26 Surcharge = 25%  $6.26 = $1.57 Total fare = $7.83 Day type: 1 Boarding hour and minute: 5 59 Distance: 9000 Total taxi fare is $11.70 First 1km: $3.40 Next 8km: 20  $0.22 = $4.40 Basic fare = $7.80 Surcharge = 50%  $7.80 = $3.90 Total fare = $ July

Taxi Fare (4/4) Note that due to inaccuracy of floating-point number representation, depending on how you code your formula to compute the taxi fare, the result may defer slightly from the model output CodeCrunch refers to. Hence, your program may fail CodeCrunch test. In this case, if the difference is very small (probably in the second decimal place), just treat your answer as correct. 25 July

Candles Alexandra has n candles. He burns them one at a time and carefully collects all unburnt residual wax. Out of the residual wax of exactly k (where k > 1) candles, he can roll out a new candle. Given the values n and k, find out how many candles he can burn. 25 July Example: n = 10 and k = 3 Answer: 14

End of file