Tugas Array dan Inheritance Kelompok 09


Tugas Algoritma dan Pemrograman Array dan inheritance

1. Write a static method removeDuplicates (Characters [] in ) that returns new array of the characters in the given array, but without any duplicate characters. Always keep the first copy of the characters and remove subsequent ones. For example, if in contains b, d, a, b, f, a, g, a, a and f, the method will return an array containing b, d, a, f, and g (in one way to solve this problem is to create a Boolean array of the same size as the given array in and use it to keep track of which characters to keep. The values in the new Boolean array will determine the size of the array to return).

Soalnya adalah bagaimana kita menghapus karakter yang sudah ada sebelumnya, jadi ketika di printout hasil yang keluar hanya sekali. Seperti screenshoot diatas, jika huruf yang dimasukin adalah (‘a’,’a’,’b’,’b’,’c’,’d’,’c’) maka yang ada dioutput nanti hanyalah a, b, c, d karena tidak boleh ada ganda karakter yang sama.

Kelompok 7

Kelas SI4002

Sylvia (1202164390)
Rizky Rahmat Hakiki(12012164146)

Muhammad Rafidan(1202160074)


Leave a Reply