Question: Create a package named string methods for this program The Starting Template for this program is shown below. Fill in code where you see highlighted
Create a package named string methods for this program The Starting Template for this program is shown below. Fill in code where you see highlighted comments with instructions in the methods readString0, countOccurrences0... etc. Write code in these highlighted sections that do what the comments request. Don't modify main0 or the printCountsO routine. When you run your program, you will need to enter in a string for the "readString" method. Use the string Aardvarks get big and bigger as You feed them big and bigger ants who Feed on apples package string methods: Starting Template import java util.Scanner public class MyStringMethods private String mystr- public void readString // Prompt the user and read in a String from a Scanner class from the keyboarod // with the nextLine ) method and store it in"ystr public void setString (String s myStr"s public Int countoccurrences (String s // use indexof and return the number of occuzzences of the string "s" in "myStr public int countoccurrences (char // use indexof and return the number of occurrences of the character "c"in "myStr" int count UpperCaselettes / return the number of upper case letters in "mySts int countLowerCaseLetters Create a package named string methods for this program The Starting Template for this program is shown below. Fill in code where you see highlighted comments with instructions in the methods readString0, countOccurrences0... etc. Write code in these highlighted sections that do what the comments request. Don't modify main0 or the printCountsO routine. When you run your program, you will need to enter in a string for the "readString" method. Use the string Aardvarks get big and bigger as You feed them big and bigger ants who Feed on apples package string methods: Starting Template import java util.Scanner public class MyStringMethods private String mystr- public void readString // Prompt the user and read in a String from a Scanner class from the keyboarod // with the nextLine ) method and store it in"ystr public void setString (String s myStr"s public Int countoccurrences (String s // use indexof and return the number of occuzzences of the string "s" in "myStr public int countoccurrences (char // use indexof and return the number of occurrences of the character "c"in "myStr" int count UpperCaselettes / return the number of upper case letters in "mySts int countLowerCaseLetters
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
