A sentence is terminated by either ".", "!" or "?" followed by a space. Input a piece of text consisting of sentences. Assume that there wil...

A sentence is terminated by either ".", "!" or "?" followed by a space. Input a piece of text consisting of sentences. Assume that there will be a maximum of 10 sentences in a block.

Write a program to:

  1. Obtain the length of the sentence (measured in words) and the frequency of vowels in each sentence.
  2. Generate the output as shown below using the given data

Examples

INPUT:

HELLO! HOW ARE YOU? HOPE EVERYTHING IS FINE. BEST OF LUCK.<br />

OUTPUT:

Sentence         No. of Vowels   No. of words
----------------------------------------------------------
  1                  2               1
  2                  5               3
  3                  8               4
  4                  3               3


Sentence        No. of words/vowels
----------------------------------------------------------
1               VVVVVV
                WWW
2               VVVVVVVVVVVVVVV
                WWWWWWWWW
3               VVVVVVVVVVVVVVVVVVVVVVVV
                WWWWWWWWWWWW
----------------------------------------------------------
Scale used 1:3
import java.io.*;
class ISCprac2008q02
{
public static void main(String arg[])throws IOException
{
 int l,j,q=0,r=0,i;
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter a paragraph : ");
     String str=br.readLine();
     str=str.toUpperCase();
     l=str.length();
     int x[]=new int[l];
     int y[]=new int[l];
   for(i=0;i< l;i++)
   {
       char ch=str.charAt(i);
       if(ch=='.'||ch=='?'||ch=='!')
       {
           int now=0;
          int nov=0;
//          for(j=q;j

Have something to say? Log in to comment on this post.

0 comments