Array fun with strings Download

Javaclass.info

basic math, arrays, strings Student approved


Introduction

In this project, you'll perform a few methods on an array of strings.


Task

  1. Make the constructors work correctly by initializing the array of strings
  2. Make the methods function as described in the source code for the project


Starter code

public class StringArr{
    private String[] sArr;

    public StringArr(){
        
    }
 
    
    //returns true if sArr contains S
    //post-condition: sArr's state remains uncchanged
    public boolean arrContains(String s){
        return false;
    }
    
    
     //returns the number of times that 
     //String s is an element in the Array of Strings
    public int countOccurrencesOf(String s){
        return 1;
    }

      
    //will print out all elements in sArr
    //whose length is greater than or equal to len
    public void  printElementsGreaterThan(int len){
    
    }
    
    
    //return the number of elements in sArr
    //that are palindromes
    public int numberPalindromes(){
        return 0;
    }    
}

Useful tools to solve the problem