1 CPS1192 COMPUTER SCIENCE II Fall Semester, 2013 Lecture 1: Overview Instructor: Ashraf Yaseen 08/27/2013 DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL STATE UNIVERSITY, WILBERFORCE, OH Outline 2 Course Administration Course Overview Review of Computer Science I Introduction to Computers and Programming Introduction to C++ Expressions and Interactivity Making Decisions Loops and Files Administrivia 3 Class Web Page http://www.cs.odu.edu/~ayaseen Syllabus Class Policy Class Notes Posted before class Read class notes before class Assignments Posted after class Pay attention to the due dates Blackboard Posting grades Sending out emails to class Administrivia-cont. 4 Instructional E-Mail Addresses ayaseen@cs.odu.edu Instructor: Ashraf Yaseen Office phone: 937-376-6365 Office location: Henderson Hall, 139 Office hours: M,W,F: 10:00AM-2:00PM T,R: 2:00PM-3:00PM by appointment Administrivia-cont. 5 Grading Policy Number Activities/ Evaluation Methods Percentages 2 Term Exam 30% 1 Final Exam ( Essay + Final Lab) 30% 16 Lab Assignment/Homework 40% Quizzes will be announced in class Late Assignment/HW Policy 0~24 hrs: -5% 24~48 hrs: -10% >48 hrs: grade = 0 >=90 80-89 70-79 60-69 <60 A B C D F Excellent Very Good Good Passed Failed Class participation and presentation quality will also impact final grade Administrivia-cont. 6 Textbook Starting out with C++ from Control Structures through Objects. By Tony Gaddis Supplies/Materials: Students are encouraged to install Visual C++ Express on their laptops CSU Honor Code 7 The Honor Code applies to your conduct in this course. If you have questions, talk to me HOMEWORK: All submitted work must be your own Do not copy another student’s work Do discuss material and homework with classmates, professor If you work with someone, write this on the first page of your submitted work EXAMS: Do not give assistance to or receive assistance from anyone but professor Violations of this Code are treated seriously Evidence of cheating, plagiarism, or unauthorized collaboration will result in a 0 grade for quiz/assignment/exam May have further consequences How to get help? 8 Ask questions in class (or after class) Attend office hours Email me Make sure that you put “CPS1192” in your subject line Send it from your .odu account It wouldn’t come to my spam folder State clearly what you need in your email How to Get an A in this Class 9 Attendance Attend class regularly and on time Ask questions Work on in-class exercises and lab assignments Notes Read over class notes before class Review class notes after class Homework Get started as early as possible Contact me if you encounter problems What You Will Learn 10 CPS 1192 prepares students for the concept and skill of object-oriented programming (OO). Topics include class and object, class inheritance, pure virtual function, polymorphism, template function and template class, exception handling, data structure What You Will Learn-cont. 11 Upon successful completion of this class, you will be able to define and implement Classes Array of objects Class Inheritance. Pure virtual function and abstract class. Polymorphism. Template function and template class. Exception handling Data structure: stack, queue and linked-list. Topics 12 C++ programming Overview Classes and Data Abstraction Inheritance and Composition Pointers, Classes, Lists, and Virtual Functions Overloading and Templates Exception Handling Recursion Linked Lists Searching and Sorting Algorithms Stacks and Queues Importance of This Course 13 Prerequisite for You must get a C or better to pass Foundation for advanced courses Operating Systems Programming Language Compiler Design Networking Parallel Programming Algorithm I/O Management About Me 14 I got my bachelor’s from JUST (Jordan University of Science & Technology) Master’s from NYiT (New York Institute of Technology) Ph.D. (in process) ODU (Old Dominion University) My Research Computational Biology High Performance Computing How about you? 15 Tell us your name and year In a few sentences, tell us about you, e.g. Where are you from? What is your major? Career plans or after-college plans? Favorite hobby, sport? Something interesting about yourself Expectation in this class Greater Expectations 16 Class Attendance & Participation: mandatory In-Class exercises/discussion questions Solidify Help gauge your understanding Increase You By If your understanding interactivity (reduce boredom) are expected to try your best in class attending, you work less out class. you miss class, you are responsible for learning what you missed Greater Expectations-cont. 17 Behave and perform in a professional manner Be punctual, dress appropriately and be attentive Respect the rights of all participants by turning off any device that could cause a disturbance during class (this includes pagers, cell phones, personal alarms and iPod music players). Negative behavior patterns in class (e.g. unexcused absences, tardiness, and class disruptions, wearing hats, eating, drinking, smoking and sleeping) will be treated seriously could result in a reduction of up to 12.5% (labs) of a student’s final grade. While in Class, 18 No Facebook No Cell phone No Music players No Topic unrelated to class. No Sleep No Food No bad jokes 19 Overview of CPS 1192: Programming in C++ Chapter 1: Introduction to Computers and Programming 20 A program is a set of instructions that the computer follows to perform a task An integrated development environment, or IDE, combine all the tools needed to write, compile, and debug a program into a single software application. Examples are Microsoft Visual C++, Turbo C++ Explorer, CodeWarrior, etc What is a Program Made of? 21 Common elements in programming languages: Key Words ProgrammerDefined Identifiers Operators Punctuation Syntax Chapter 2: Introduction to C++ 22 The Parts of a C++ Program comment // sample C++ program preprocessor directive #include <iostream> which namespace to use using namespace std; beginning of function named main int main() { beginning of block for main output statement cout << "Hello, there!"; string literal return 0; send 0 to operating system end of block for main } cout/cin, include 23 cout/cin cout << "Programming is" << endl; cout << "fun!"; int grade; cin>>grade; #include Directive Variables and Literals 24 Identifiers 25 IDENTIFIER VALID? REASON IF INVALID totalSales Yes total_Sales Yes total.Sales No Cannot contain . 4thQtrSales No Cannot begin with digit totalSale$ No Cannot contain $ Data Types & Defining Variables 26 Char, String 27 Variable Scope 28 Chapter 3: Expressions and Interactivity 29 Cin Object Reads Different Data Types Mathematical Expressions Order of Operations Algebraic Expressions Type Casting 30 Combined Assignment Operators 31 Formatting Output 32 Stream Manipulator 33 Mathematical Library Functions 34 Require cmath header file Take double as input, return a double Commonly used functions: sin cos tan sqrt log abs Sine Cosine Tangent Square root Natural (e) log Absolute value (takes and returns an int) Chapter 4: Making Decisions 35 Relational Operators >, <, <=, >=, ==, != Do not confuse = and == Relational Expressions The if Statement Expanding if Statement 36 Nested if Statements if/else if Statement Logical Operators, AND, OR, NOT 37 int x = 12, y = 5, z = -4; (x > y) && (y > z) true (x > y) && (z > y) false (x <= z) || (y == z) false (x <= z) || (y != z) true !(x >= z) false switch Statement 38 Chapter 5: Loops and Files 39 While loop 40 Do-while 41 For loop 42 Nested for Loop Inner Loop Outer Loop Breaking and Continuing a Loop Using Files for Data Storage 44 Summary Syllabus Review of CPS1191 Topics Introduction to Computers and Programming Introduction to C++ Expressions and Interactivity Making Decisions Loops and Files What I want you to do Review Chapters 1-5 and Class Slides Prepare for the 2nd part of the review Chapters 6-8 from CPS1191 Functions Arrays Searching and Sorting Arrays Enjoy your new semester