This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 5acb4e9c authored by OEResource sharing's avatar OEResource sharing
Browse files

OEResource: Update resource with id: 48712275-3cd1-4bb5-a4f0-94c3b7293825

parents
No related merge requests found
public class CountVowels {
private static int countVowels(String text){
//Implementieren Sie Ihre Lösung hier.
return 0; //TODO: Entferne diese Zeile.
}
private static int countVowels(String text, char vowel){
//Implementieren Sie Ihre Lösung hier.
return 0; //TODO: Entferne diese Zeile.
}
public static void main(String[] args) {
//TODO: Testen Sie Ihr Programm hier.
//System.out.println(countVowels("Hello"));
//...
}
}
## Zähle die Vokale
#### Aufgabenstellung:
Implementieren Sie eine Methode `countVowels`, die eine Methode `countVowels` überlädt:
1. `int countVowels(String text)`: Diese Methode zählt die Anzahl der Vokale im übergebenen String `text` und gibt die Anzahl zurück.
2. `int countVowels(String text, char vowel)`: Diese Methode zählt die Anzahl des spezifizierten Vokals `vowel` im übergebenen String `text` und gibt die Anzahl zurück.
***Hinweis:*** Verwenden Sie die Methode `System.out.println()` in der `main`-Methode, um die Anzahl der Vokale auszugeben. Sowohl Klein- als auch Großschreibung sollte berücksichtigt werden.
#### Beispiele:
```
countVowels("Hello") --> 2
countVowels("Hello", 'o') --> 1
countVowels("Universum") --> 4
countVowels("Universum", 'u') --> 2
countVowels("Auto") --> 3
```
\ No newline at end of file
audience: Advanced Beginners
creator:
- affiliation: Technische Universität Wien
email: nadja.jovancevic@tuwien.ac.at
name: Nadja Jovancevic
description: Man sollte zwei überladene Methoden implementieren, die die Vokale in
einem String zählen.
difficulty: easy
format:
- md
- java
keyword:
- Strings
- If conditionals
- For loops
- Methods
- Overloading
language:
- de
learningResourceType: Programming exercise
license: CC BY 4.0
metadataVersion: '0.5'
programmingLanguage:
- Java
publisher:
- affiliation: Technische Universität Wien
email: nadja.jovancevic@tuwien.ac.at
name: Nadja Jovancevic
teaches:
- Java/Data Types/Strings
- Java/Controlflow/Loops
- Java/Controlflow/Conditionals/If Statements
- Java/Methods
timeRequired: < 15 min
title: Vokale zählen
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment