hello quizlet
Home
Subjects
Expert solutions
Create
Study sets, textbooks, questions
Log in
Sign up
Upgrade to remove ads
Only $35.99/year
Science
Computer Science
EX2: WK6 Object Oriented Programming
Flashcards
Learn
Test
Match
Flashcards
Learn
Test
Match
Terms in this set (21)
Using the Enhanced for Loop with Objects
Use the X to cycle through an array of objects - Eliminates the need to use a limiting value - Eliminates the need for a subscript following each element for(Employee worker : emp) System.out.println(worker.getEmpNum() + " " + worker.getSalary();
Parallel array
- One with the same number of elements as another - The values in corresponding elements are related ■ An alternative for searching - Use the while loop
Searching an Array for a Range Match
■ Searching an array for an exact match is not always practical
■ X - Compare a value to the endpoints of numerical ranges - Find the category in which a value belongs
Bubble Sort Algorithm
is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted
Insertion Sort Algorithm
is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. However, insertion sort provides several advantages:
Simple implementation: Jon Bentley shows a three-line C version, and a five-line optimized version[2]:116
Efficient for (quite) small data sets, much like other quadratic sorting algorithms
More efficient in practice than most other simple quadratic (i.e., O(n2)) algorithms such as selection sort or bubble sort
Selection Sort Algorithm
is a combination of searching and sorting. During each pass, the unsorted element with the smallest (or largest) value is moved to its proper position in the array.
Array
Length: Fixed Length
Data Types: Primitive, Objects
Create: int[] myArray= new int[10]; int[] myArray= {1,2,3,4,5,6,7,8,9,10};
Dog[] dogs = new Dog[25]
Length: len = myArray.length
Array size is defined when the array is declared
ArrayList
Length: Variable Length
Data Types :Objects, Generics
Performance : Same
Create :ArrayList<Integer>myList= new ArrayList<>();
ArrayList<Cat> cats = new ArrayList<Cat>();
ArrayList<Cat> cats = new ArrayList<Cat>(25);
Length: len = myList.size();
In ArrayList the size of the array is dynamic
Inheritance
- A mechanism that enables one class to X both the behavior and the attributes of another class - Apply your knowledge of a general category to more specific objects
- Saves time - Reduces errors - Reduces the amount of new learning required to use a new class
Unified Modeling Language (UML)
is a general-purpose, developmental, modeling language in the field of software engineering, that is intended to provide a standard way to visualize the design of a system.
- Consists of many types of diagram
Class diagram
- A visual tool - Provides an overview of a class
Base class
- Used as a basis for inheritance - Also called: ■ Superclass ■ Parent class
Derived class
- Inherits from a base class - Always "is a" case or an example of a more general base class - Also called: ■ Subclass ■ Child class
Keyword extends
- Used to achieve inheritance in Java - Example: public class EmployeeWithTerritory X Employee ■ Inheritance is a one-way proposition - A child inherits from a parent, not the other way around ■ Subclasses are more specific
Polymorphism
- The same method name is used to indicate different implementations
Override the method in the parent class
- Create a method in a child class that has the same name and parameter list as a method in its parent class
Subtype polymorphism
- The ability of one method name to work appropriately for different subclass objects of the same parent class
Override annotation (@Override)
- Tells compiler you are X a parent class method - Insert X annotation just prior to the method - Program will work without any X tags but using the tag can help you prevent errors and document
instantiate
■ When you X an object that is a member of a subclass, you call at least two constructors: - The constructor for the base class - The constructor for the extended class ■ The superclass constructor must execute first ■ When the superclass contains a default constructor, the execution of the superclass constructor is transparent
this()
Used to access current class constructor.
Use only inside another constructor of same class .
Call to this method must be the first statement.
super ()
Used to access parent class constructor from child class
Use only inside child class constructor to call parent class
Call to X must be the first statement
Sets found in the same folder
EX2: WK5 Object Oriented Programming
24 terms
EX2: WK7 Object Oriented Programming
25 terms
EX2: WK8 Object Oriented Programming
25 terms
EX1: WK1 Programming Basics
23 terms
Other sets by this creator
EX1: WK4 Object Oriented Programming
15 terms
EX1: WK3 Object Oriented Programming
17 terms
EX1: WK2 Object Oriented Programming
34 terms
EX2 Ch 14 Installation & Operations
7 terms
Verified questions
computer science
Which of the following are legal int literals? ``` 22 1.5 −1 2.3 10.0 5. −6875309 '7' ```
biology
Aaron has blood type O. Can either of his parents have blood type AB? Explain your answer.
engineering
Three balanced three-phase loads are connected in parallel. Load 1 is Y-connected with an impedance of 400 + j300 Ω/Φ; load 2 is Δ-connected with an impedance of 2400 - j1800 Ω/Φ; and load 3 is 172.8 + j2203.2 kVA. The loads are fed from a distribution line with an impedance of 2 + j16 Ω/Φ. The magnitude of the line-to-neutral voltage at the load end of the line is 24 √3 kV. a) Calculate the total complex power at the sending end of the line. b) What percentage of the average power at the sending end of the line is delivered to the loads?
biology
What part of the turkey has the most tryptophan?
Recommended textbook solutions
Computer Organization and Design MIPS Edition: The Hardware/Software Interface
5th Edition
•
ISBN: 9780124077263
(5 more)
David A. Patterson, John L. Hennessy
220 solutions
Information Technology Project Management: Providing Measurable Organizational Value
5th Edition
•
ISBN: 9781118898208
Jack T. Marchewka
346 solutions
Information Technology Project Management: Providing Measurable Organizational Value
5th Edition
•
ISBN: 9781118898208
Jack T. Marchewka
346 solutions
Fundamentals of Database Systems
7th Edition
•
ISBN: 9780133970777
(1 more)
Ramez Elmasri, Shamkant B. Navathe
687 solutions
Other Quizlet sets
Histology - Connective Tissue I: Cells & Fibers
103 terms
Psychology Exam 1
53 terms
Anatomical Positions
27 terms
Theo test chapter 5
44 terms