1 / 8

Object Oriented Programming

Object Oriented Programming. Lecture 6 : Review Mustafa Emre İlal emreilal@iyte.edu.tr. Recap. Last week: Arrays + Strings Assignment 0 5. Today. Assignment 05 - Solutions Review In-class coding exercises Thinking in Java – Chapter 6, 7. Assignment 06. 1.

zared
Download Presentation

Object Oriented Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object Oriented Programming Lecture 6: Review Mustafa Emre İlal emreilal@iyte.edu.tr

  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 applicationthat 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 4 8 6 1 2 9 4 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: deductionsdiscounteddiscounterintroducesreductionsharmonicasmaraschinopercussionsupersonic

  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

More Related