Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA ARRAYS. Please use arrays Write a program to classify input text into four

ID: 3585110 • Letter: J

Question

JAVA ARRAYS. Please use arrays

Write a program to classify input text into four categories: regular, some exaggeration, a lot of exaggeration, and hyperbole. The classification is based on the number of hyperbole words in the text. If the percentage of hyperbole words is-15% then regular, [15%,25%) then some exaggeration. [25%, 35%) a lot of exaggeration, and >= 35% then hyperbole List of hyperbole words to look for: appropriately e assertively authoritativel collaboratively compellingly competently completely continually conveniently e credibly . distinctively dramatically e dynamically e efficiently . energistically enthusiastically * fungibly . globally holisticly interactively intrinsically monotonectally objectively phosfluorescently proactively professionally progressively e quickly e rapidiously seamlessly e synergistically uniquely For example in the sentence "We are globally recognized the percentage is 1/4 0.25, so this sentence is classified as 'a lot of exaggeration

Explanation / Answer

import java.io.*;
import java.util.*;

public class DemoText{
    public static void main(String[] args){

       String[] hyperbole_words = new String[31];
       String line;
       Scanner sc = new Scanner(System.in);
       hyperbole_words[0] = "appropritely";
       hyperbole_words[1] = "assertively";
       hyperbole_words[2] = "authoritatively";
       hyperbole_words[3] = "collaboratively";
       hyperbole_words[4] = "compellingly";
       hyperbole_words[5] = "competently";
       hyperbole_words[6] = "completely";
       hyperbole_words[7] = "continually";
       hyperbole_words[8] = "conveniently";
       hyperbole_words[9] = "credibly";
       hyperbole_words[10] = "distinctively";
       hyperbole_words[11] = "dramatically";
       hyperbole_words[12] = "dynamically";
       hyperbole_words[13] = "efficiently";
       hyperbole_words[14] = "energistically";
       hyperbole_words[15] = "enthusiastically";
       hyperbole_words[16] = "fungibly";
       hyperbole_words[17] = "holisticaly";
       hyperbole_words[18] = "interactively";
       hyperbole_words[19] = "intrinsically";
       hyperbole_words[20] = "monotonectally";
       hyperbole_words[21] = "phosfluroscently";
       hyperbole_words[22] = "proactively";
       hyperbole_words[23] = "professionally";
       hyperbole_words[24] = "progressively";
       hyperbole_words[25] = "quickly";
       hyperbole_words[26] = "rapidiously";
       hyperbole_words[27] = "seamlessly";
       hyperbole_words[28] = "synergistically";
       hyperbole_words[29] = "uniquely";
       hyperbole_words[30] = "globally";

       System.out.println("Enter text:");
       line = sc.nextLine();
       double count = 0;
       String[] arr = line.split(" ");
      
      
       for (int i = 0; i<31; i++){
          
           if (line.toLowerCase().contains(hyperbole_words[i]))
              count++;

       }
       double value = count/arr.length;

       String str = "";
       if (value < 0.15){
          str = "regular";
       }
       if (value >= 0.15 && value < 0.25){
          str = "some exaggeration";
       }
       if (value >= 0.25 && value < 0.35){
          str = "a lot of exaggeration";
       }
       if (value >= 0.35){
         str = "hyperbole";
       }
       System.out.println(str);
    }
}