Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

CS508 Modern Programming Languages Assignment No 02 Spring 2021 Solution / Discussion

Views: 1140

Replies to This Discussion

Share the Assignment Questions & Discuss Here.... 

Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.

Jin logo nay mil kar quiz karana ha wo CS508 ka wo mujy PM kar day kindly 

okay !

hona ha add

Gee sure

yes

Assignment Question:-

Problem Statement:

In English language, there are twenty-six alphabets. Which are further divided into five vowels (a, e, i, o, u) and twenty-one consonants (remaining alphabets).

 

You are required to write a program in SNOBOL4 which will count the total number of vowels and consonants in a string.  

 

  • At start, take a string as input from user.
  • Print that string on top of the console screen.
  • Design two separate patterns which should contain vowels and consonants respectively.
  • Create a loop using 'go to field', which will match characters of string with patterns.
  • If any character in string is matched with vowels pattern then store it in a variable by using concatenation, increment the counter by 1, and move to the next character.
  • If not matched with vowel, then do the same with consonants pattern.
  • At end, simply print the counters and stored characters on console with appropriate message.

For example, if input string is

A quick brown fox jumps over the lazy dog.

 

Then your program must print on console,  

Found 11 vowels:  A u i o o u o e e a o

Found 22 consonants:  q c k b r w n f x j m p s v r t h l z y d g

 

However, in case, there is no vowel or consonant in the input string then following message should be displayed.

Found no vowel.         or         Found no consonant.

 

Note:

It is required to make sure that the program should count for both small and capital characters. For example, the program must count 6 vowels and 11 consonants for string "THIS is a SAMPLE text". Furthermore, spaces and punctuation marks (! . , ; : ? etc.) should not be counted.

Compiler:

 

For compilation purpose, you can consult any online compiler, like

https://tio.run/#snobol4

 

Vowels and Consonants:

 

Type

Characters

Vowels

a, e, i, o, u

Consonants

b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z

 

Sample Output:

 

Fig. Sample Output

 

Good Luck

Assignment File, Please provide Idea Solution.

Attachments:

i need Idea Solution of assignment #2 cs508 and cs411

Any Idea Solution? Just 2 Days Remaining!

CS508 ASSIGNMENT 2 SOLUTION 

* BC178878

            STRING = INPUT

            OUTPUT = "INPUT STRING: " STRING

 

           

            P1 = ( 'A' | 'I' | 'O' | 'U' | 'E' | 'a' | 'i' | 'e' | 'o' | 'u' ) . V

            P2 = ( 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' ) . c

           

            S1 = ''

            S2 = ''

           

            C1 = 0

            C2 = 0

 

L1 STRING P1 = :F(L2)

            S1 = S1 ' '  V

            C1 = C1 + 1 :S(L1)

           

L2 STRING P2 = :F(L3)

            S2 = S2 ' '  C

            C2 = C2 + 1 :S(L1)

 

L3 OUTPUT = ' FOUND '  C1  ' VOWELS ' S1

 

            OUTPUT = ' FOUND '  C1  ' CONS ' S2

 

           

           

END

 

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service