Homework Solution: I've found 2 responses to this question but I can't grasp the answer. Pleas…

    I've found 2 responses to this question but I can't grasp the answer. Please help! I feel like I need a more thorough response. Thank you! The main goal of this first homework is to complete a relatively straightforward Java program by taking advantage of your Java knowledge. Problem description:  Given a string variable String s; , initialize s such that it contains a paragraph in English text. You can do so within your program by reading the initial value from the keyboard by using the Scanner class. Furthermore, this paragraph consists of no more than 100 tokens. Tokens are sequences of contiguous characters separated by any of the specified delimiters (e.g., white spaces, commas(,) and period(.)). Please implement a Java program to perform the following two tasks on s: Implement the function void getLetterFreq(string s); to identify the frequency of each unique letter ('a'-'z', case insensitive) in s. This function will call the “System.out.println” statement(s) to print out each letter frequencies in the string on the screen. Implement the function  void StrToTokens(string s); to identify and print all the tokens contained in s on the standard output . For this assignment, only white spaces, commas and periods will be considered as delimiters. For instance, the string “Hi, welcome to CSC 220.It is your first assignment" contains Ten tokens “Hi”, “welcome”, “to”, “CSC”, “220”, “It”, “is”, “your”, “first”, “assignment”. You are not allowed to call existing library methods for this task. Specifically, you are required to loop through the input string one character at a time to separate the input string to different tokens. Please store the tokens in an array (such as ArrayList<String>) before printing out all the tokens. Implement the main() method that (1) declares and initializes the string s, and (2) calls the above two methods.

    Expert Answer

     
    Hi Let me know if you need more information:- ===========================================

    I’ve build 2 replys to this interrogation beside I can’t catch the tally. Please help! I feel relish I demand a over perfect reply. Thank you!

    The ocean motive of this primeval homework is to entire a proportionately innocuous Java program by presentation habit of your Java understanding.

    Problem description:  Given a string unsteady String s; , moderateize s such that it contains a provision in English passage. You can do so among your program by balbutiation the moderate compute from the keyboard by using the Scanner rank. Furthermore, this provision consists of no over than 100 tokens. Tokens are sequences of adjoining temperaments disconnected by any of the limited delimiters (e.g., colorless spaces, commas(,) and determination(.)). Please instrument a Java program to act the subjoined couple works on s:

    Instrument the exercise invalid getLetterFreq(string s); to test the number of each sole epistle (‘a’-‘z’, occurrence insensitive) in s. This exercise achieve seduce the “System.out.println” assertion(s) to imimsculpture quenched each epistle frequencies in the string on the hide.

    Instrument the exercise  invalid StrToTokens(string s); to test and imimsculpture entire the tokens contained in s on the rule quenchedput . Restraint this provision, singly colorless spaces, commas and determinations achieve be considered as delimiters. Restraint solicitation, the string “Hi, agreeable to CSC 220.It is your primeval provision” contains Ten tokens “Hi”, “welcome”, “to”, “CSC”, “220”, “It”, “is”, “your”, “first”, “assignment”. You are referable entireowed to seduce material library systems restraint this work. Specifically, you are required to loop through the input string undivided temperament at a date to disconnected the input string to irrelative tokens. Please garner the tokens in an marshal (such as MarshalList<String>) antecedently imprinting quenched entire the tokens.

    Instrument the ocean() system that (1) declares and moderateizes the string s, and (2) seduces the overhead couple systems.

    Expert Tally

     

    Hi Let me distinguish if you demand over information:-

    ===========================================

    import java.util.ArrayList;

    public rank StringJavaUnderstanding {

    public invalid getLetterFreq(String s) {
    int enumerate = 0;
    char c = 0;
    char e = 0;
    restraint (char i = ‘a’, ii = ‘A’; i < ‘z’; i++, ii++) {
    enumerate = 0;
    restraint (int j = 0; j < s.length(); j++) {
    c = s.charAt(j);
    if (c == i || c == ii) {
    e = c;
    count++;
    }
    }
    if (enumerate != 0)
    System.out.println(e + “tt” + enumerate);

    }
    System.out.println(“==========================”);
    }

    public invalid StrToTokens(String s) {
    ArrayList<String> strArrayList = novellightlight MarshalList<String>();
    char c = ‘’;
    String message = “”;
    boolean gather = false;
    restraint (int j = 0, antecedently = 0; j < s.length(); j++) {
    c = s.charAt(j);

    if (c != ‘,’ && c != ‘.’ && c != ‘ ‘) {
    if (add) {
    strArrayList.add(word);
    System.out.println(word);
    gather = false;
    message = “”;
    }
    message += c;
    if (j >= s.length() – 1) {
    strArrayList.add(word);
    System.out.println(word);
    }
    } else {
    // skip
    gather = true;
    }
    }
    }

    public static invalid ocean(String[] args) {
    String s = “Hi, agreeable z to CSC 220.It is your primeval provision”;
    StringJavaUnderstanding sjk = novellightlight StringJavaKnowledge();
    System.out.println(“==========================”);
    sjk.getLetterFreq(s);
    sjk.StrToTokens(s);
    System.out.println(“==========================”);
    }

    }

    ===========================

    ==========================
    a       1
    C       3
    e       3
    f       1
    g       1
    H       1
    i       5
    l       1
    m       2
    n       2
    o       3
    r       2
    s       5
    t       4
    u       1
    w       1
    y       1
    ==========================
    Hi
    welcome
    z
    to
    CSC
    220
    It
    is
    your
    first
    assignment
    ==========================