• Tidak ada hasil yang ditemukan

Praktikum PBO

N/A
N/A
Nguyễn Gia Hào

Academic year: 2023

Membagikan "Praktikum PBO"

Copied!
5
0
0

Teks penuh

(1)

Praktikum PBO

String

(2)

Soal 1

• Buatlah program untuk menghitung jumlah huruf dan angka dalam sebuah kalimat

• Kalimat : Keputih 78 A

• Jumlah huruf : 8

• Jumlah angka : 2

(3)

Soal 2

• Write a program that reads a string and then prints a diamond shaped array based on the characters of the string. As an example, if the string has the value "SAMPLE", then the program should print the pattern

S SAS SAMAS SAMPMAS SAMPLPMAS SAMPLELPMAS SAMPLPMAS SAMPMAS SAMAS SAS S

(4)

Soal 3

• A palindrome is a string that reads the same both forward and backward.

Examples of palindromes are "radar" and "31413".

(a) Write a boolean-valued method isPalindrome that has a single String parameter.

The method should return true if and only if its parameter is a palindrome.

(b) Modify your method so that it ignores cases of letters, punctuation marks, and blanks in making a decision about whether or not a string is a palindrome. For

example, the string:

"A man, a plan, a canal: Panama!"

should be taken to be a palindrome.

Write a program that prompts the user for a string and notifies the user if it is apalindrome.

(5)

Soal 4

• Exercise: An anagram is a word or a phrase made by transposing the letters of another word or phrase; for example, "parliament" is an anagram of "partial men," and "software" is an anagram of "swear oft." Write a program

that figures out whether one string is an anagram of another string. The program

should ignore white space and punctuation.

• Example

Referensi

Dokumen terkait

Pronunciation is the act or manner of pronouncing words; utterance of speech, a way of speaking a word, especially a way that is accepted or generally understood, and

Based on the data, the linguistic forms which commonly used by Indonesian Instagram users are: “Word” (13) , “Phrase” (6), “Idiom” (3), and “Clause” (1), There is no