# ECET 370 DEVRY COURSE TUTORIAL/UOPHELP

### providing accessible,easy to understand

ECET 370 Entire Course (Devry)

For more course tutorials visit

www.uophelp.com

ECET 370 Week 1 Labs 1

ECET 370 Week 2 Labs 2

ECET 370 Week 3 Lab 3 Linked Lists

ECET 370 Week 4 Lab 4 Complexities of Computational Problems

ECET 370 Week 5 Lab 5 Search Algorithms and Techniques

ECET 370 Week 7 Lab 7 Binary Trees

&&&&&&&&&&&&&&&&&&&&&&&&&&&&

ECET 370 Week 1 Lab 1 (Devry)

For more course tutorials visit

www.uophelp.com

General Instructions

Exercises 1, 2, 4, and 5 use the programs in DocSharinglabeled “User-defined classes."

Exercises 7 and 8 use the programs in DocSharinglabeled “Using interfaces."

Exercise 1: Review of classes Create a project using the classes in the DocSharing area labeled “User-defined classes." Compile it, run it, and review the code that is given carefully.

Exercise 2: User-defined methods the function area of the Triangle class is the framework of the actual method. Modify it so that it calculates the area of the triangle. Write a Main class to test your area method. Note: to calculate the area of a triangle from the vertices, first find the distances between each pair of vertices to obtain the length of the sides of the triangle. Then apply Heron’s formula to calculate the area given the length of the sides.

Exercise 3: Shallow versus deep copy Provide an example of shallow copy of objects and an example of deep copy of objects.

Exercise 4: Passing parameters to methods Write a function that swaps two Point objects. Use the code given below: import java.util.*; public class Main { public Main() { Scanner Scanner(System.in); System.out. print("Enter x and y coordinates of first point: "); Point Point (in.nextDouble(), in.nextDouble()); System.out. print("Enter x and y coordinates of second point: "); Point Point (in.nextDouble(), in.nextDouble()); swap(p1, p2); System.out.println(" Compile it, run it, and review the code that is given carefully. Note: The class Point implements the Comparable interface. The Comparable interface contains a single method: compareTo, which is used to compare two objects p and q of the same class type. When calling p.compareTo(q), it returns an integer. If this value is negative it means that p is smaller; if it is equal to zero then , and if the value is positive, it indicates that p is greater than q.

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

ECET 370 Week 2 Lab 2 (Devry)

For more course tutorials visit

www.uophelp.com

General Instructions

Exercises 1, 2, and 3 use the programs in DocSharinglabeled “User-defined array list."

Exercise 4 uses the programs in DocSharinglabeled “Using java.util.ArrayList."

Exercise 1: Review of array-based lists Create a project using the classes in the DocSharing area labeled “User-defined array list." Compile it, run it, and review the code that is given carefully. This code tests the Array List class provided in the lecture.

Exercise 2: A user-defined array list Modify the class Array List given in the lecture by adding to it the functions listed below for Exercise 2. In each case, the appropriate error message should be generated if an invalid condition occurs. For example, an error message should be generated when trying to insert an item in a given location in the list and the location is out of range. a. Array List (int size): create a constructor that sets the size of the array list to the value passed in size (note that the class variable SIZE cannot be final anymore). b. int length(): create this function to determine the number of items in the list (access or function). c. intgetSize(): create this function to determine the size of the list (accessor function). d. void clear(): create this function to remove all of the items from the list. After this operation, the length of the list is zero. e. void replace(int location, int item): create this function to replace the item in the list at the position specified by location. The item should be replaced with item. f.

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

ECET 370 Week 3 Lab 3 Linked Lists (Devry)

For more course tutorials visit

www.uophelp.com

General Instructions

Exercises 1, 2, and 3 use the programs in DocSharinglabeled “User-defined linked list."

Exercise 4 uses the programs in DocSharinglabeled “Using java.util.LinkedList."

Exercise 1: Review of Linked Lists Create a project using the classes in the DocSharing area labeled “User-defined linked list." Compile it, run it, and review the code that is given carefully. This code tests the Linked List class provided in the lecture. Extend the class Main to test the functions is Empty, search and remove of the class Linked List.

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&