Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object Oriented Programming

Similar presentations


Presentation on theme: "Object Oriented Programming"— Presentation transcript:

1 Object Oriented Programming
Lecture 6: Review Mustafa Emre İlal

2 Recap Last week: Arrays + Strings Assignment 05

3 Today Assignment 05 - Solutions Review In-class coding exercises
Thinking in Java – Chapter 6, 7

4 Assignment 06.1 Find the smallest distance between two neighboring numbers in an array: Write a Java application that creates an array of 500 random doubles between 1-100, and then prints out, the smallest difference between two neighboring numbers and where in the array it exists. e.g. In the sequence the minimum difference is 1 (between 1 and 2). This exists between indexes 3 and 4. Hint: Use Math.abs() to calculate the difference between two numbers.

5 Assignment 06.2 Check for Anagrams
An anagram is a word or a phrase that can be created by rearranging the letters of another given word or phrase. We ignore white spaces and letter case. e.g.: "Desperation" can be rearranged to the phrase "A Rope Ends It". Implement a Java application that looks for all anagrams of a given String in an array of Strings. The array is given below. Pick any to use as the String to search for. Hints: First prepare your Strings: Use .toLowerCase() method to convert all to lower case. Use .toCharArray() to convert the String into a char-array. Remember that char is a subset of int. char can be used in place of int. Try using it as index for an array holding counters for each letter of the alphabet.

6 Assignment 06.2 Check for Anagrams The words array to be used is:
deductions discounted discounter introduces reductions harmonicas maraschino percussion supersonic

7 Assignment 06.3 Remove duplicate elements
Write a Java Application that first creates an array of 20 random integers between 1-20. Prints out this array (on a single line) Then removes duplicate values The application should print out the final array along with its final size.

8 Next Week Interfaces Inner classes
Preperation: Thinking in Java Chapter 8 + 9


Download ppt "Object Oriented Programming"

Similar presentations


Ads by Google