Upload
dorthy-grant
View
218
Download
1
Tags:
Embed Size (px)
Citation preview
CPS1192 COMPUTER SCIENCE II
Fall Semester, 2013
CPS1192 COMPUTER SCIENCE II
Fall Semester, 2013
08/27/2013
Lecture 1: OverviewInstructor: Ashraf Yaseen
DEPARTMENT OF MATH & COMPUTER SCIENCECENTRAL STATE UNIVERSITY, WILBERFORCE, OH
1
Outline
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
2
Administrivia
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
3
Administrivia-cont.
Instructional E-Mail Addresses [email protected]
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
4
Administrivia-cont.
Grading Policy
Quizzes will be announced in class
Late Assignment/HW Policy 0~24 hrs: -5% 24~48 hrs: -10% >48 hrs: grade = 0
5
Number
Activities/ Evaluation Methods
Percentages
2 Term Exam 30%
1 Final Exam ( Essay + Final Lab)
30%
16 Lab Assignment/Homework
40%
Class participation and presentation quality will also impact final grade
>=90 A Excellent80-89 B Very Good70-79 C Good60-69 D Passed<60 F Failed
Administrivia-cont.
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
6
CSU Honor Code 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
7
How to get help?
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
8
How to Get an A in this Class 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
9
What You Will Learn
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
10
What You Will Learn-cont.
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.
11
Topics
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
12
Importance of This Course
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
13
About Me
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
14
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
Class Attendance & Participation: mandatory In-Class exercises/discussion questions
Solidify your understanding
Help gauge your understanding
Increase interactivity (reduce boredom)
You are expected to try your best in class
By attending, you work less out class.
If you miss class, you are responsible for learning what you missed
16
Greater Expectations-cont.
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.
17
While in Class,
No Facebook No Cell phone No Music players No Topic unrelated to class. No Sleep No Food No bad jokes
18
Overview of CPS 1192: Programming in C++
19
Chapter 1: Introduction to Computers and Programming
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
20
What is a Program Made of?
Common elements in programming languages: Key Words Programmer- Defined Identifiers Operators Punctuation Syntax
21
Chapter 2: Introduction to C++
22
// sample C++ program
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, there!";
return 0;
}
preprocessor directive
comment
which namespace to use
beginning of function named main
beginning of block for main
output statement
end of block for main
string literalsend 0 to operating system
The Parts of a C++ Program
cout/cin, include
cout/cin cout << "Programming is" << endl;cout << "fun!";
int grade;
cin>>grade;
#include Directive
23
Variables and Literals24
Identifiers25
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, String27
Variable Scope28
Chapter 3: Expressions and Interactivity
Cin Object Reads Different Data Types
Mathematical Expressions
Order of Operations
Algebraic Expressions
29
Type Casting30
Combined Assignment Operators
31
Formatting Output
Stream Manipulator
32
33
Mathematical Library Functions Require cmath header file Take double as input, return a double Commonly used functions:
34
sin Sine cos Cosinetan Tangentsqrt Square rootlog Natural (e) logabs Absolute value (takes and returns an int)
Chapter 4: Making Decisions
Relational Operators >, <, <=, >=, ==, != Do not confuse = and ==
Relational Expressions
The if Statement
35
Expanding if Statement36
Nested if Statements
if/else if Statement
Logical Operators, AND, OR, NOT int x = 12, y = 5, z = -4;
37
(x > y) && (y > z) true
(x > y) && (z > y) false
(x <= z) || (y == z) false
(x <= z) || (y != z) true
!(x >= z) false
switch Statement38
Chapter 5: Loops and Files39
While loop40
Do-while41
For loop42
Nested for Loop
Inner Loop
Outer Loop
Breaking and Continuing a Loop
Using Files for Data Storage44
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