Programming & Problem Solving I
Programming & Problem Solving I CECS 174
Popular in Course
Popular in Computer Science and Engineering
This 11 page Class Notes was uploaded by Zackary Cronin on Monday October 5, 2015. The Class Notes belongs to CECS 174 at California State University - Long Beach taught by Staff in Fall. Since its upload, it has received 45 views. For similar materials see /class/218757/cecs-174-california-state-university-long-beach in Computer Science and Engineering at California State University - Long Beach.
Reviews for Programming & Problem Solving I
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/05/15
CHAPTER 1 INTRODUCTION AND REVIEW CECS 174 Programming and Problem Solving I covers the basics of programming After taking CECS 174 you should 0 be able to write simple programs 0 understand the basics of C 0 be familiar with simple types structs classes and arrays o understand how to compile and execute C programs This course CECS 274 Programming and Problem SolVing II will focus on the tools you need to solve sophisticated problems with the computer An alternative name for this course might be the design and implementation of algorithms and data structures used in computer science DLfn An algorithm is a list of instructions to accomplish a given task An algorithm has 0 or more inputs 1 or more results unambiguous instructions a nite number of steps in which it terminates Defn A data structure is a concrete organization imposed on a collection of data A Developing Software In this class we will be primarily concerned with the development of good software But what is good software and how do we create it Problem Because software is becoming increasingly complex it is extremely dif cult to create errorfree ef cient and useful software Solution Don t code ro rams instead en ineer software 7 1 Software Life Cycle or the Engineering Process 0 Requirements Specification Clearly state the problem and understand what is needed for its solution Analysis Identify the components of the problem input output etc 0 Design Create a solution to the problem and document the solution Develop a Test Plan Decide how the correctness of the program will be determined 0 Implementation or coding Do the programming 0 Testing Systematically test the program 0 Operation Use the software 0 Maintenance Update or modify the program 2 Goals of Software Engineering or The Characteristics of Good Software Correctness Does the software meet its speci cations Predictability Does the software always behave in a predictable understandable manner Understandability Can the software code be understood and maintained Modi ability Can the software be easily changed to meet new needs Reusability Can the software be used in other systems Efficiency Does the software make optimal use of computer resourcestime memory IO devices B Review 1 Types Defn Types consist of two components 1 a set of values 2 a set of operations applied to the values Example 1 int Values 4 10 99 Operations etc Example 2 bool Values 1 O or true false Note 0 is false and all nonzero values are true Operations ampamp etc Strongly vs Weakly Typed Languages Defn A language is strongly typed if 1 Every object variable in the language has a unique type that does not change during the life of the object 2 Each object s type is de ned by a declaration at compilation time so that the compiler can determine whether that object is being used correctly C satisfies only condition 1 Examples 0 Ada is a strongly typed language 0 C is not as strongly a typed language SOYou must be very careful in C Example Problem With Typing C will let you do the following oat Ans int A B A7 B2 AnsAB We would like the value stored in Ans to be 35 but C will do integer division on A and B Thus Ans will have the value 30 Probably not what the programmer wants In Ada Ans A B would never even be compiled successfully because Ans has a different type from A and B Thus this problem would not occur 2 Types in C There are three operations applicable to all scalar types 0 assignment or copying o equality test 0 inequality test In C types are classi ed into one of two categories scalar or composite Scalar Types or Simple Types In a scalar type each value has a single component Examples 0 Integer types int Flavors short ShortInt long LongInt o Floatingpoint types oat Temp double DoubleVar o Enumeration types enum Colors Red Green Blue Composite Types or Structured Types In a composite type each value can have multiple components Examples 0 Record Types or Structures struct SampleRec Typel Fieldl Type2 Field2 TypeN FieldN 0 Class Types class Classl public void functionl private int intVar 0 Array Types int intArraylO or const int MAX 10 oat FloatArrayMAX
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'