Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * TODO Put here a description of what this class does.
- *
- * @author Jake. Created Apr 25, 2019.
- */
- public class Main {
- private booleanWrapper bool;
- private booleanWrapper bool2;
- public static void main(String[] args) {
- new Main();
- }
- /**
- * TODO Put here a description of what this method does.
- *
- */
- private Main() {
- this.bool = new booleanWrapper();
- this.bool2 = new booleanWrapper();
- boolean boo1 = true;
- boolean boo2 = true;
- String s = "jkmnb";
- String d = "jake";
- noVowels2(s, bool);
- noVowels2(d, bool2);
- System.out.println("noVowels1(s): " + noVowels1(s));
- System.out.println("noVowels1(s): " + noVowels1(d));
- System.out.println("noVowels2(s, bool): " + bool.noVowels);
- System.out.println("noVowels2(d, bool2): " + bool2.noVowels);
- System.out.println("noVowels3(s, boo1): " + noVowels3(s, boo1));
- System.out.println("noVowels3(d, boo2): " + noVowels3(d, boo2));
- }
- public boolean noVowels1(String s) {
- if(s.length() == 0) {
- return true;
- } else if(s.charAt(0)=='a' || s.charAt(0)=='e' || s.charAt(0)=='i' || s.charAt(0)=='o' || s.charAt(0)=='u') {
- return false;
- } else {
- return noVowels1(s.substring(1));
- }
- }
- public void noVowels2(String s, booleanWrapper bool) {
- if(s.length() == 0 || s == null) {
- bool.noVowels = true;
- return;
- }
- if(s.charAt(0) == 'a' || s.charAt(0) == 'e' || s.charAt(0) == 'i' || s.charAt(0) == 'o' || s.charAt(0) == 'u') {
- bool.noVowels = false;
- return;
- } else {
- noVowels2(s.substring(1), bool);
- }
- }
- public boolean noVowels3(String s, boolean bool) {
- if(s.length() == 0 || s == null) {
- bool = true;
- return bool;
- }
- if(s.charAt(0) == 'a' || s.charAt(0) == 'e' || s.charAt(0) == 'i' || s.charAt(0) == 'o' || s.charAt(0) == 'u') {
- bool = false;
- return bool;
- } else {
- return noVowels3(s.substring(1), bool);
- }
- }
- public class booleanWrapper {
- public boolean noVowels = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement