SlideShare una empresa de Scribd logo
1 de 9
ECET 370 Week 1 Lab 1
For more classes visit
www.snaptutorial.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.
Exercise 8: Implementation of interfaces Using the class Point in the
DocSharing area labeled “Using interfaces," write an application that
declares an array of Points, fills the array with random points, and
finds the smallest point in the array.
******************************************************
ECET 370 Week 1 Lab 1
For more classes visit
www.snaptutorial.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.
Exercise 8: Implementation of interfaces Using the class Point in the
DocSharing area labeled “Using interfaces," write an application that
declares an array of Points, fills the array with random points, and
finds the smallest point in the array.
******************************************************
ECET 370 Week 2 Lab 2
For more classes visit
www.snaptutorial.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 ArrayList class provided in the lecture.
Exercise 2: A user-defined array list Modify the class ArrayList 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. ArrayList(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 (accessor 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. void
insert(int location, int item): create this function to add an item to the
list at the position specified by location. g. void remove(int item):
create this function to delete an item from the list. All occurrences of
item in the list should be removed. h. int get(int location): create a
function that returns the element at location. i. public ArrayList
copy(): create a function that makes a deep copy to another ArrayList
object.
Exercise 3: Using an array-based list Using the class ArrayList
completed in the previous exercise, write a program that uses it to
store 100 random numbers. Consider that each of these random
numbers is an integer in the interval [0, 200]. Write the program in
such a way that there are no number duplicates.
Exercise 4: Review of the library class java.util.ArrayList Create a
project using the classes in the DocSharing area labeled “Using
java.util.ArrayList." Compile it, run it, and review the code that is
given carefully. This code is the complete program given in our
lecture that tests the library class java.util.ArrayList.
Exercise 5: Using the library class java.util.ArrayList Rewrite
Exercise 3 (above) using the class java.util.ArrayList to store the 100
random numbers.
ECET 370 Week 3 Lab 3 Linked Lists
For more classes visit
www.snaptutorial.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
LinkedList class provided in the lecture. Extend the class Main to test
the functions isEmpty, search and remove of the class LinkedList.
Exercise 2: A User-Defined Linked List Modify the class LinkedList
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. a. toString(): modify the
display function to overload the toString function of the Object class.
b. int length(): create this function to determine the number of items
in the list (accessor function). c. void clear(): create this function to
remove all of the items from the list. After this operation is
completed, the length of the list is zero. d. void insertEnd(int item):
create this function to insert item at the end of the list. 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. int get(int location): create a function that
returns the element at the position location.
Exercise 3: Using a Linked List This exercise is similar to Exercise 3
in Lab 2, but uses the LinkedList class implemented in Exercise 2
above. That is, using the class LinkedList, write a program that uses it
to store 100 random numbers. Again, consider that each of these
random numbers is an integer in the interval [0, 200]. Write the
program in such a way that there are no number duplicates.
Exercise 4: Review of the Library Class java.util.LinkedList Create a
project using the class in the DocSharing area labeled “Using
java.util.LinkedList." Compile it, run it, and review the code that is
given carefully. This code is the complete program given in our
lecture that tests the library class java.util.LinkedList. Exercise 5:
Using the Library Class java.util.LinkedList Rewrite Exercise 3
(above) using the class java.util.LinkedList to store the 100 random
numbers.
******************************************************
ECET 370 Week 4 Lab 4 Complexity of
Computational Problems
For more classes visit
www.snaptutorial.com
General Instructions
Exercise 1 uses the programs in DocSharinglabeled “Minimum,"
“Factorial,” and “Sorting algorithms."
Exercise 1: Review of the Lecture Contents Create projects using the
classes in the DocSharing areas labeled “Minimum," “Factorial,” and
“Sorting algorithms." Compile them, run them, and review the code
that is given carefully. These programs test the code discussed in the
lecture.
Exercise 2: Efficiency of Algorithms Problem 2 in the Section
“Projects” at the end of Chapter 9 in the textbook: find a value of n
for which Loop B is faster.
Exercise 3: Recursion Problem 1 in the Section “Projects” at the end
of Chapter 10 in the textbook: recursive algorithm to find the square
root of a given number. Exercise 4: Sorting In this week’s lecture, the
algorithms quicksort and bubblesort are described and implemented.
In DocSharing, under the section labeled “Sorting algorithms," you
can find the class ArrayList where these sorting algorithms are
implemented. Write a Java program that times both of them for
various values of n. Create a table to record the times. Regarding the
efficiency of both sorting methods, what conclusion can be reached
from this experiment? Note: You can probably save development time
by using the program from Week 2 to generate a list of the 1000
smallest prime numbers (in random order). This list could then be
used as the input to the sorting algorithms.
******************************************************
ECET 370 Week 5 Lab 5 Search Algorithms and
Techniques
For more classes visit
www.snaptutorial.com
General Instructions
Exercise 1 uses the programs in DocSharinglabeled “Search
algorithms."
Exercise 1: Review of the Lecture Content Create a project using the
ArrayList class and the Main class provided in DocSharing. The
ArrayList class contains implementations of the first three search
methods explained in this week’s lecture: sequential, sorted, and
binary search. The Main class uses these three methods. These
programs test the code discussed in the lecture. Compile the project,
run it, and review the code that is given carefully.
Exercise 2: Search Algorithms and Techniques Expand the project
developed in the previous exercise to perform the following
experiment: time the three search methods several times each and
record the results. Compare the running times of the three search
methods (sequential search, sorted search, and binary search) which
are obtained during the experiment. What conclusions can be drawn?
Exercise 3: Searching Applications Select one of the following two
problems to solve: Problem 1: Design and implement an algorithm
that determines whether or not a given array of elements, list1, is
completely contained within another given array of elements, list2.
Consider two different scenarios: 1) both arrays are sorted; 2) both
arrays are unsorted. Problem 2: Design an algorithm that when given
a collection of integers in an unsorted array, determines the second
smallest number (or second minimum). For example, if the array
consists of the values 12, 23, 9, 17, 3, the algorithm should report the
value 9, since it is the second smallest number in the array. Write a
function that receives an array as a parameter and returns the second
smallest number. To test your function, write a program that
populates an array with random numbers and then call your function.
Exercise 4: Hashing Suppose that the type of key in a hashing
application you are implementing is String (Sections 19.6 and 19.7 in
our textbook explain hash functions for strings). Design, implement,
and test a hash function that converts a key to a hash value. Assume
that the size of the hash table is a prime number.
*******************************************************
ECET 370 Week 7 Lab 7 Binary Trees
For more classes visit
www.snaptutorial.com
Full set of lab with working programs.
Exercise 1: Lecture review: Binary Search Tree Create a project using
the classes BinarySearchTree, Node, and Main in the DocSharing area
labeled “The BST." Compile the project, run it, and review the code
that is given carefully. These programs test the code discussed in our
lecture.
Exercise 2: An improved BST class Modify the class
BinarySearchTree so that it contains the toString method, instead of
the display method that was given originally.
Exercise 3: Using a BST in an application Use a binary search tree to
implement a dictionary that contains the keywords in the Java
language. Test it. Note that you can use the programs from the
previous exercises. For a list of the keywords in Java, visit
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.
html.
Exercise 4: Recursion and Binary Trees Write a recursive algorithm
that counts the nodes in a binary search tree.
Exercise 5: Using properties of BSTs Write an algorithm getMax to
find the maximum value stored in a binary search tree.
**********************************************************************************

Más contenido relacionado

La actualidad más candente

Lecture 5: Functional Programming
Lecture 5: Functional ProgrammingLecture 5: Functional Programming
Lecture 5: Functional Programming
Eelco Visser
 
Functional Objects & Function and Closures
Functional Objects  & Function and ClosuresFunctional Objects  & Function and Closures
Functional Objects & Function and Closures
Sandip Kumar
 
Python advanced 3.the python std lib by example – algorithm
Python advanced 3.the python std lib by example – algorithmPython advanced 3.the python std lib by example – algorithm
Python advanced 3.the python std lib by example – algorithm
John(Qiang) Zhang
 

La actualidad más candente (19)

Collections
CollectionsCollections
Collections
 
Hub102 - JS - Lesson3
Hub102 - JS - Lesson3Hub102 - JS - Lesson3
Hub102 - JS - Lesson3
 
Icom4015 lecture4-f17
Icom4015 lecture4-f17Icom4015 lecture4-f17
Icom4015 lecture4-f17
 
Writea program that defines a template function named add(). Thisfunction tak...
Writea program that defines a template function named add(). Thisfunction tak...Writea program that defines a template function named add(). Thisfunction tak...
Writea program that defines a template function named add(). Thisfunction tak...
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
Scala oo (1)
Scala oo (1)Scala oo (1)
Scala oo (1)
 
Icom4015 lecture13-f16
Icom4015 lecture13-f16Icom4015 lecture13-f16
Icom4015 lecture13-f16
 
Lecture 5: Functional Programming
Lecture 5: Functional ProgrammingLecture 5: Functional Programming
Lecture 5: Functional Programming
 
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
 
Functional Objects & Function and Closures
Functional Objects  & Function and ClosuresFunctional Objects  & Function and Closures
Functional Objects & Function and Closures
 
Lecture 01 variables scripts and operations
Lecture 01   variables scripts and operationsLecture 01   variables scripts and operations
Lecture 01 variables scripts and operations
 
Java data types
Java data typesJava data types
Java data types
 
Implicit conversion and parameters
Implicit conversion and parametersImplicit conversion and parameters
Implicit conversion and parameters
 
The Drunken Landlady
The Drunken LandladyThe Drunken Landlady
The Drunken Landlady
 
Java Tutorial Lab 8
Java Tutorial Lab 8Java Tutorial Lab 8
Java Tutorial Lab 8
 
Class 32: Interpreters
Class 32: InterpretersClass 32: Interpreters
Class 32: Interpreters
 
Arrays in programming
Arrays in programmingArrays in programming
Arrays in programming
 
Introduction to Loc
Introduction to LocIntroduction to Loc
Introduction to Loc
 
Python advanced 3.the python std lib by example – algorithm
Python advanced 3.the python std lib by example – algorithmPython advanced 3.the python std lib by example – algorithm
Python advanced 3.the python std lib by example – algorithm
 

Similar a ECET 370 Exceptional Education - snaptutorial.com

Goals1)Be able to work with individual bits in java.2).docx
Goals1)Be able to work with individual bits in java.2).docxGoals1)Be able to work with individual bits in java.2).docx
Goals1)Be able to work with individual bits in java.2).docx
josephineboon366
 
The second programming assignment (HW4) is designed to help you ga.docx
The second programming assignment (HW4) is designed to help you ga.docxThe second programming assignment (HW4) is designed to help you ga.docx
The second programming assignment (HW4) is designed to help you ga.docx
oreo10
 
Assignment Examples Final 07 Oct
Assignment Examples Final 07 OctAssignment Examples Final 07 Oct
Assignment Examples Final 07 Oct
Sriram Raj
 
OverviewUsing the C-struct feature, design, implement and .docx
OverviewUsing the C-struct feature, design, implement and .docxOverviewUsing the C-struct feature, design, implement and .docx
OverviewUsing the C-struct feature, design, implement and .docx
alfred4lewis58146
 
Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docx
dunhamadell
 

Similar a ECET 370 Exceptional Education - snaptutorial.com (20)

Ecet 370 week 1 lab
Ecet 370 week 1 labEcet 370 week 1 lab
Ecet 370 week 1 lab
 
ECET 370 Redefined Education--ecet370.com
ECET 370 Redefined Education--ecet370.comECET 370 Redefined Education--ecet370.com
ECET 370 Redefined Education--ecet370.com
 
ECET 370 Education Planning--ecet370.com
 ECET 370 Education Planning--ecet370.com ECET 370 Education Planning--ecet370.com
ECET 370 Education Planning--ecet370.com
 
ECET 370 Effective Communication/tutorialrank.com
 ECET 370 Effective Communication/tutorialrank.com ECET 370 Effective Communication/tutorialrank.com
ECET 370 Effective Communication/tutorialrank.com
 
ECET 370 Inspiring Innovation--ecet370.com
ECET 370 Inspiring Innovation--ecet370.comECET 370 Inspiring Innovation--ecet370.com
ECET 370 Inspiring Innovation--ecet370.com
 
08review (1)
08review (1)08review (1)
08review (1)
 
Java conceptual learning material
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
 
CS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUALCS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUAL
 
Goals1)Be able to work with individual bits in java.2).docx
Goals1)Be able to work with individual bits in java.2).docxGoals1)Be able to work with individual bits in java.2).docx
Goals1)Be able to work with individual bits in java.2).docx
 
The second programming assignment (HW4) is designed to help you ga.docx
The second programming assignment (HW4) is designed to help you ga.docxThe second programming assignment (HW4) is designed to help you ga.docx
The second programming assignment (HW4) is designed to help you ga.docx
 
JAVA CONCEPTS
JAVA CONCEPTS JAVA CONCEPTS
JAVA CONCEPTS
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
 
Assignment Examples Final 07 Oct
Assignment Examples Final 07 OctAssignment Examples Final 07 Oct
Assignment Examples Final 07 Oct
 
OverviewUsing the C-struct feature, design, implement and .docx
OverviewUsing the C-struct feature, design, implement and .docxOverviewUsing the C-struct feature, design, implement and .docx
OverviewUsing the C-struct feature, design, implement and .docx
 
Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docx
 
LectureNotes-06-DSA
LectureNotes-06-DSALectureNotes-06-DSA
LectureNotes-06-DSA
 
JavaScript(Es5) Interview Questions & Answers
JavaScript(Es5)  Interview Questions & AnswersJavaScript(Es5)  Interview Questions & Answers
JavaScript(Es5) Interview Questions & Answers
 
Ch-2ppt.pptx
Ch-2ppt.pptxCh-2ppt.pptx
Ch-2ppt.pptx
 
MA3696 Lecture 9
MA3696 Lecture 9MA3696 Lecture 9
MA3696 Lecture 9
 

Último

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Último (20)

psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

ECET 370 Exceptional Education - snaptutorial.com

  • 1. ECET 370 Week 1 Lab 1 For more classes visit www.snaptutorial.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
  • 2. 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. Exercise 8: Implementation of interfaces Using the class Point in the DocSharing area labeled “Using interfaces," write an application that declares an array of Points, fills the array with random points, and finds the smallest point in the array. ****************************************************** ECET 370 Week 1 Lab 1 For more classes visit www.snaptutorial.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.
  • 3. 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. Exercise 8: Implementation of interfaces Using the class Point in the DocSharing area labeled “Using interfaces," write an application that declares an array of Points, fills the array with random points, and finds the smallest point in the array. ****************************************************** ECET 370 Week 2 Lab 2 For more classes visit www.snaptutorial.com General Instructions Exercises 1, 2, and 3 use the programs in DocSharinglabeled “User- defined array list."
  • 4. 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 ArrayList class provided in the lecture. Exercise 2: A user-defined array list Modify the class ArrayList 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. ArrayList(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 (accessor 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. void insert(int location, int item): create this function to add an item to the list at the position specified by location. g. void remove(int item): create this function to delete an item from the list. All occurrences of item in the list should be removed. h. int get(int location): create a function that returns the element at location. i. public ArrayList copy(): create a function that makes a deep copy to another ArrayList object. Exercise 3: Using an array-based list Using the class ArrayList completed in the previous exercise, write a program that uses it to store 100 random numbers. Consider that each of these random numbers is an integer in the interval [0, 200]. Write the program in such a way that there are no number duplicates. Exercise 4: Review of the library class java.util.ArrayList Create a project using the classes in the DocSharing area labeled “Using java.util.ArrayList." Compile it, run it, and review the code that is
  • 5. given carefully. This code is the complete program given in our lecture that tests the library class java.util.ArrayList. Exercise 5: Using the library class java.util.ArrayList Rewrite Exercise 3 (above) using the class java.util.ArrayList to store the 100 random numbers. ECET 370 Week 3 Lab 3 Linked Lists For more classes visit www.snaptutorial.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 LinkedList class provided in the lecture. Extend the class Main to test the functions isEmpty, search and remove of the class LinkedList. Exercise 2: A User-Defined Linked List Modify the class LinkedList 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. a. toString(): modify the display function to overload the toString function of the Object class. b. int length(): create this function to determine the number of items in the list (accessor function). c. void clear(): create this function to remove all of the items from the list. After this operation is completed, the length of the list is zero. d. void insertEnd(int item): create this function to insert item at the end of the list. e. void replace(int location, int item): create this function to replace the item
  • 6. in the list at the position specified by location. The item should be replaced with item. f. int get(int location): create a function that returns the element at the position location. Exercise 3: Using a Linked List This exercise is similar to Exercise 3 in Lab 2, but uses the LinkedList class implemented in Exercise 2 above. That is, using the class LinkedList, write a program that uses it to store 100 random numbers. Again, consider that each of these random numbers is an integer in the interval [0, 200]. Write the program in such a way that there are no number duplicates. Exercise 4: Review of the Library Class java.util.LinkedList Create a project using the class in the DocSharing area labeled “Using java.util.LinkedList." Compile it, run it, and review the code that is given carefully. This code is the complete program given in our lecture that tests the library class java.util.LinkedList. Exercise 5: Using the Library Class java.util.LinkedList Rewrite Exercise 3 (above) using the class java.util.LinkedList to store the 100 random numbers. ****************************************************** ECET 370 Week 4 Lab 4 Complexity of Computational Problems For more classes visit www.snaptutorial.com General Instructions Exercise 1 uses the programs in DocSharinglabeled “Minimum," “Factorial,” and “Sorting algorithms." Exercise 1: Review of the Lecture Contents Create projects using the classes in the DocSharing areas labeled “Minimum," “Factorial,” and
  • 7. “Sorting algorithms." Compile them, run them, and review the code that is given carefully. These programs test the code discussed in the lecture. Exercise 2: Efficiency of Algorithms Problem 2 in the Section “Projects” at the end of Chapter 9 in the textbook: find a value of n for which Loop B is faster. Exercise 3: Recursion Problem 1 in the Section “Projects” at the end of Chapter 10 in the textbook: recursive algorithm to find the square root of a given number. Exercise 4: Sorting In this week’s lecture, the algorithms quicksort and bubblesort are described and implemented. In DocSharing, under the section labeled “Sorting algorithms," you can find the class ArrayList where these sorting algorithms are implemented. Write a Java program that times both of them for various values of n. Create a table to record the times. Regarding the efficiency of both sorting methods, what conclusion can be reached from this experiment? Note: You can probably save development time by using the program from Week 2 to generate a list of the 1000 smallest prime numbers (in random order). This list could then be used as the input to the sorting algorithms. ****************************************************** ECET 370 Week 5 Lab 5 Search Algorithms and Techniques For more classes visit www.snaptutorial.com General Instructions
  • 8. Exercise 1 uses the programs in DocSharinglabeled “Search algorithms." Exercise 1: Review of the Lecture Content Create a project using the ArrayList class and the Main class provided in DocSharing. The ArrayList class contains implementations of the first three search methods explained in this week’s lecture: sequential, sorted, and binary search. The Main class uses these three methods. These programs test the code discussed in the lecture. Compile the project, run it, and review the code that is given carefully. Exercise 2: Search Algorithms and Techniques Expand the project developed in the previous exercise to perform the following experiment: time the three search methods several times each and record the results. Compare the running times of the three search methods (sequential search, sorted search, and binary search) which are obtained during the experiment. What conclusions can be drawn? Exercise 3: Searching Applications Select one of the following two problems to solve: Problem 1: Design and implement an algorithm that determines whether or not a given array of elements, list1, is completely contained within another given array of elements, list2. Consider two different scenarios: 1) both arrays are sorted; 2) both arrays are unsorted. Problem 2: Design an algorithm that when given a collection of integers in an unsorted array, determines the second smallest number (or second minimum). For example, if the array consists of the values 12, 23, 9, 17, 3, the algorithm should report the value 9, since it is the second smallest number in the array. Write a function that receives an array as a parameter and returns the second smallest number. To test your function, write a program that populates an array with random numbers and then call your function. Exercise 4: Hashing Suppose that the type of key in a hashing application you are implementing is String (Sections 19.6 and 19.7 in our textbook explain hash functions for strings). Design, implement, and test a hash function that converts a key to a hash value. Assume that the size of the hash table is a prime number.
  • 9. ******************************************************* ECET 370 Week 7 Lab 7 Binary Trees For more classes visit www.snaptutorial.com Full set of lab with working programs. Exercise 1: Lecture review: Binary Search Tree Create a project using the classes BinarySearchTree, Node, and Main in the DocSharing area labeled “The BST." Compile the project, run it, and review the code that is given carefully. These programs test the code discussed in our lecture. Exercise 2: An improved BST class Modify the class BinarySearchTree so that it contains the toString method, instead of the display method that was given originally. Exercise 3: Using a BST in an application Use a binary search tree to implement a dictionary that contains the keywords in the Java language. Test it. Note that you can use the programs from the previous exercises. For a list of the keywords in Java, visit http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords. html. Exercise 4: Recursion and Binary Trees Write a recursive algorithm that counts the nodes in a binary search tree. Exercise 5: Using properties of BSTs Write an algorithm getMax to find the maximum value stored in a binary search tree. **********************************************************************************