Beruflich Dokumente
Kultur Dokumente
Primitive data types can perform simple arithmetic. Reference data types require methods to be manipulated. Initial conditions => Problem => Result input => Plan of Action => Outcome
A group of individual instructions in a program that takes control of the program. The control structure should have only one entry and one exit point.
Control Structure
String msg = new String Demonstrate two ways to ("foo"); //with instantiation declare the string msg = "foo" String msg = "foo"; //without instantiation
In a left-decision tree nested control structure the "IF"s are nested in the "IF" structures not in the else block structure. They are not commonly used. The syntax is as follows: IF (cond1) IF (cond2) Statement 1 ELSE Statement 2 ELSE Statement 3
Describe a nested control structure. What are the two form of nestes control structure
Multiple number of "IF" statements are nested during a process. There are two forms of nested control structure, left-decision tree and right-decision tree
The conditional path is selected if the condition is true. If false, the corresponding statement(s) will be passed and the lines of code following the block are executed.
In a right-decision tree nested control structure, the statements are tested until a true statement is found. This is the most common nested control structure. The syntax follows: IF (cond1) Statement 1 ELSE IF (cond2) Statement 2 ELSE IF (cond3) Statement 3 ELSE Statement 4
The switch statement allows you to choose from a fixed set of alternatives. It is used in a narrow collection of situations. Switches should not be used with real numbers. only Integers and integer compatibles (characters) Switches must use "breaks" to avoid code "fall through"
Describe Encapsulation
Describe Inheritance
Each object is related to one or more objects. One class of objects inherits data behavior from another object. In other words, sub classes share characteristics of the class they are derived from.
Describe Polymorphism
The capability of an object to assume different forms. Messages can lead to different operations depending on the object receiving it. Example: Context based right clicking Formal definition: The mechanism by which one general interface can be used to access different specific implementations.
Describe the AND operator. Give an example of how it can be used with bit sequences
True when all conditions are true. The java syntax is &&. Used for filtering/masking a bit pattern. Allow only the 1st and 2nd bits through: 10101101 00000011 00000001
Describe the Bottom Up design structure and give advantages and disadvantages
Modules are designed first, then put together to form the main program. Advantages: Less expensive and faster to build Disadvantages: The pieces don't always work well together.
Describe the OR operator. Give an example of how it can be used with bit sequences
True when any input is true. The java syntax is || Used for bit setting (sets any or all bits to 1) in a sequence. Set the 2nd bit: 10101101 00000010 10101111
Describe the XOR operator. Give an example of how it can be used with bit sequencing
Also called the equivalence operator. Returns FALSE when both statements are the same. The Java syntax is a compound statement (!ab + a!b). Used for testing bit sequence errors (unexpected state change) and also for flipping: 10101101 11111111 01010010
Describe Top Down design structure and give advantages and disadvantages
The overall structure of the program is already known and modules are integrated as design progresses. Disadvantage: Expensive and time consuming Advantage: Highly customized.
Switching Theory Software Engineering Automation and Control Robotics Biotechnology Hardware Design
Generally speaking software engineers convert problems of analysis to problems of synthesis which can then be solved by computers.
How does Java handle dangling pointers caused by string literals declared without instantiation?
Java periodically runs a GarbageCollection method to eliminate objects with zero reference.
Relational Operators
Allows the program to execute one of the alternative paths. The selection is governed by the outcome of a conditional test that evaluates if a statement is true or false.
1. Avoid algorithms which cause informal problems. 2. Avoid algorithms with undetermined solutions 3. Avoid algorithms which require excessive amounts of time. 4. Select algorithms that closely fit the specifications 5. Select algorithms which allow for assumptions 6. Select algorithms which don't generate multiple problems 6.1 Examine the algorithm's efficiency
String Tokenization
Using ReadLine(), it is possible to convert a string of multiple items into individual values (tokens). String Tokenization generally requires wrapper classes to convert between different integer types
1. Format the program in a way that enhances its readability 2. Use spaces between segments 3. All composite sequences must be separated 4. Use appropriate (and well named) identifiers
1. Program structure and design 2. Program Documentation 3. Program Overall Appearance and Style
1. When a comparison (equality) is performed 2. When the same expression is being compared in each condition 3. When the type of value to which the expression being compared is integer compatible
Characterized by complete specification of a problem: initial conditions, plan of action, and expected outcome.
Informal problems have no satisfactory solution. The result of the problem cannot be achieved knowing the specifications of the problem (initial conditions and the plan of action). There is no satisfactory solution.
1. For Supporting multiple or complex conditions 2. For setting or clearing bit sequences
Complex software programs requiring proper abstraction and separating the internal implementation from external behavior of the object.
1. Explanation of components 2. Functioning of each unit 3. Summary of the problem specification 4. Special algorithms (if used) 5. Assumptions made 6. Formulation 7. Name of program 8. Date 9. Date of last modification 10. Project Name 11. Division/Dpt 12. References used for program development
One-way selection control structure, two-way selection control structure, and multiway selection control structure.
What are the two program design structures that are commonly used?
Wrapper classes allow us to convert between different variable types: strings, integers, doubles, booleans, etc
1. A space is reserved for an int data type 2. The variable name gets associated with the first byte of allocated storage
1. A list of all variable objects and their associated data types are generated for compiling. 2. Sufficient memory is allocated for the declared type as referenced by the address. 3. The first byte of the address is assigned to the reference name, only after the object is instantiated. The allocation is not done until the object is instantiated. Therefore string msg; does nothing.
Consists of a Data Structure and methods that can be applied to that structure. A class is a module unit. Class = operations + data structure
A computer program is the statement of an algorithm in a computer programming language. It is a collection of instructions that a computer can understand, process and accomplish. It is an exacting task.
A unit of a program module that contains a sequence of operations and statements. In Java, methods can ONLY exist within a class.
A structure consisting of interrelated segments arranged in logical order to form an integrated unit. It is constructed basically from classes.
A general outline of the major steps we need to accomplish our goal, starting at predefined initial conditions.
A formal problem where the initial condition (input) and the result (output) are known. The goal is to identify the plan of action. Problems of Analysis are generally solved by a programmer or software engineer A formal problem where the initial condition (input) and the plan of action are known. The goal is to identify the result (output). Problems of Synthesis are generally solved by a computer.
What is a Problem?
A goal or a task. The difference between actual conditions and those that are required or desired.
Used to shift bit patterns to the right or to the left. Logical shifts multiply or divide the pattern by the pattern's base. (LogicalShiftLeft x) (LogicalShiftRight /) Static methods are called by prefixing them with the class name. No instance variables of any object of the class are defined in the method. Example: Math.pow(2,3) calls the exponent method pow.
The method is associated with an object and use the instance variables of that object. Instance methods are called by prefixing it with an object. Example: System.out.println("") Strict methods are also known as instance methods
What is a String?
A string is a REFERENCE data type where the variable references the location in memory where the actual value is stored. The actual stored value is the object.
Refers to a data type together with a set of operations that can be performed on that data structure.
All objects have: 1. Name 2. Behavior 3. Receives input (receives message) Example: Remote Control name - remote control behavior - changes channels on a television receives input - from user using the number/keypad
What is an Object
The process of obtaining the address from a reference variable and going to the address to retrieve the correct number of bytes for the object.
The study of how computers can be applied effectively and efficiently to solve problems.
What is Instantiation
What is Parsing
The study of characteristics of problems. Most problems have certain characteristics that are independent of the details of any particular problem or may have a relation to other problems in general.
Identify where input comes from and what they are. User? Storage?
Identify the outputs of the computer program. Does something get displayed on the screen? On a printer?
To provide software developers with: Reliability Cost effectiveness Adaptability Understandability Reusable
DecimalFormat is a static method because it is called simply from it's class name. No object name is used.