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

This is PHP and HTMl website language and this is not Java or python Your progra

ID: 3879221 • Letter: T

Question

This is PHP and HTMl website language and this is not Java or python  

Your program will read in text from a textarea in html, calculate certain statistics.  The statistics are as follows:

The number of characters in the text

The number of letters in the text

The number of consonants in the text

The number of digits in the text

The number of white-space characters in the text

The number of "word characters" in the text

The number of punctuation characters in the text

The number of each word in the text

Program specifications

The program should begin by displaying a brief introduction of the program.

For the purpose of this assignment, a consonant is a letter that is not a vowel: a, e, i, o, or u The letter y is considered a consonant

For the purpose of this assignment, punctuation characters are

! (exclamation)

~ (tilde)

` (acute accent)

^ (carat)

( (left parenthesis)

) (right parenthesis)

_ (underscore)

{ (left brace)

} (right brace)

[ (left bracket)

] (right bracket)

| (vertical bar)

(backslash)

; (semicolon)

: (colon)

" (quotation mark)

' (apostrophe)

, (comma)

. (period)

? (question mark)

The "word characters" are characters that are typically read as words. For the purpose of this assignment, the word characters are

@ (at)

# (pound/number)

$ (dollar)

% (percent)

& (ampersand)

+ (plus)

- (to/minus)

= (equals)

< (less-than)

> (greater-than)

* (star)

/ (or)

The output should be formatted like this example :

Statistics:

   Characters: 21
   Letters: 13
   Consonants: 8
   Digits: 0
   Spaces: 2
   Word characters: 0
   Punctuation: 6

   ......

Explanation / Answer

index.html ::-------------------------->>>>>>>>>>>>>>>>

<!DOCTYPE html>
<html>
<head>
<title>Statistics</title>
</head>
<body>
<form action="act.php" method="post">
  <textarea rows="20" cols="40" name="area" required="required">
   
  </textarea><br><br>
  <input type="submit" name="sub" value="proceed">
</form>
</body>
</html>

act.php : ----------------->>>>>>>>>>>>>>>

<?php
if(isset($_POST["sub"])){
  $text = $_POST["area"];
  $character = 0;
  $lett = 0;
  $conson = 0;
  $digit = 0;
  $white = 0;
  $wordC = 0;
  $punc = 0;

  for($i = 0;$i<strlen($text);$i++){
   switch ($text[$i]) {
    case 'f':
    case 'b':
    case 'c':
    case 'd':
    case 'g':
    case 'h':
    case 'j':
    case 'k':
    case 'l':
    case 'm':
    case 'n':
    case 'p':
    case 'q':
    case 'r':
    case 's':
    case 't':
    case 'v':
    case 'w':
    case 'x':
    case 'y':
    case 'z':
    case 'F':
    case 'B':
    case 'C':
    case 'D':
    case 'G':
    case 'H':
    case 'J':
    case 'K':
    case 'L':
    case 'M':
    case 'N':
    case 'P':
    case 'Q':
    case 'R':
    case 'S':
    case 'T':
    case 'V':
    case 'W':
    case 'X':
    case 'Y':
    case 'Z':
     $conson = $conson + 1;
     $lett = $lett + 1;
     # code...
     break;
    case 'a':
    case 'i':
    case 'e':
    case 'o':
    case 'u':
    case 'A':
    case 'E':
    case 'I':
    case 'O':
    case 'U':
     $lett = $lett + 1;
     # code...
     break;
    case ' ':
     $white = $white + 1;
     break;
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
    case '0':
     $digit = $digit + 1;
     break;
    case '~':
    case '!':
    case '`':
    case '^':
    case ')':
    case '(':
    case '{':
    case '}':
    case '[':
    case ']':
    case ':':
    case ''':
    case '"':
    case ';':
    case ',':
    case '.':
    case '?':
    case '\':
    case '_':
     $punc = $punc + 1;
     break;
    case '=':
    case '@':
    case '#':
    case '$':
    case '%':
    case '&':
    case '<':
    case '>':
    case '/':
    case '-':
    case '+':
     $wordC = $wordC + 1;
     break;
    default:
     # code...
     break;
   }
   $character = $character + 1;
  }

  ?>
<!DOCTYPE html>
<html>
<head>
<title>Statistics</title>
</head>
<body>
<p><b>Statistics</b></p>
<p>
  <span><b>Characters : <?=$character?></b></span><br>
  <span><b>Letter : <?=$lett?></b></span><br>
  <span><b>Consonant : <?=$conson?></b></span><br>
  <span><b>Digits : <?=$digit?></b></span><br>
  <span><b>Spaces : <?=$white?></b></span><br>
  <span><b>Word Character : <?=$wordC?></b></span><br>
  <span><b>Punctuation : <?=$punc?></b></span>
</p>

</body>
</html>
<?php
}
?>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote