Question

Design an algorithm ( code C ) to calculate the frequency of each of the vowels...

Design an algorithm ( code C ) to calculate the frequency of each of the vowels (lowercase and uppercase) in a text. The program will ask the user for a text, which will be entered by keyboard and will save, in a table (in%), the frequency of each of the vowels within the text, taking into account all the characters of the text. The text will end with the character '' # ''. Includes the emty sequence.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The following program illustrates the given question:

 // Java program to print Number of // Vowels import java.util.*; import java.lang.*; import java.io.*; public class Stringfun {       void words(String str) { int vCount = 0; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); switch (c) { // program for calculating number of vowels case 'A': case 'E': case 'I': case 'O': case 'U': case 'a': case 'e': case 'i': case 'o': case 'u': vCount++; } } System.out.println("Number of vowels = " + vCount); } // Driver program to run and test above program public static void main(String args[]) throws IOException {      int l;  String str; Scanner sc=new Scanner(System.in); do{ str = sc.nextLine(); l=str.length(); }while((str.charAt(l-1))!='#'); Stringfun obj = new Stringfun(); obj.words(str); } } 
Add a comment
Know the answer?
Add Answer to:
Design an algorithm ( code C ) to calculate the frequency of each of the vowels...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in C++, Design a program that asks the user to enter a password, and then analyze...

    in C++, Design a program that asks the user to enter a password, and then analyze the password, and then analyze the password for the following weaknesses: 1. Fewer than 8 characters 2. Does not contain at least one uppercase letter and one lowercase latter 3. Does not contain at least one numeric digit 4. Does not contain at least one special character( a character that is not a letter or numeric digit) 5. Is a sequence of consecutive uppercase...

  • ‘C’ programming language question Write a MENU DRIVEN program to A) Count the number of vowels...

    ‘C’ programming language question Write a MENU DRIVEN program to A) Count the number of vowels in the string B) Count the number of consonants in the string C) Convert the string to uppercase D) Convert the string to lowercase E) Display the current string X) Exit the program The program should start with a user prompt to enter a string, and let them type it in. Then the menu would be displayed. User may enter option in small case...

  • Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To...

    Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To compile, build, and execute an interactive program with a simple loop, conditions, user defined functions and library functions from stdio.h and ctype.h. You will write a program that will convert characters to integers and integers to characters General Requirements • In your program you will change each letter entered by the user to both uppercase AND lowercase– o Use the function toupper in #include...

  • Char type: Edit the provided starter-code char_type.py so it takes the user to enter some text,...

    Char type: Edit the provided starter-code char_type.py so it takes the user to enter some text, then display the number of vowels, consonants,digits, and special characters in the text. In english the vowels are the letters "a" , "e" , "i", "o", "u", "y". All other letters are consonants. The digits are "0"-"9". The special characters are those that are not letters or digits. The program should countthe number of each type of character in the text user enters, then...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

  • Python program. Character-Analysis Program Problem Statement: Design a program - IN PYTHON - that asks the...

    Python program. Character-Analysis Program Problem Statement: Design a program - IN PYTHON - that asks the user to enter a string. The string will then be displayed back to the user. This is followed by determining the number of alphabetic characters, numeric characters, lower_case letters, upper_case letters, whitespace characters, and then displaying them. The user should be given additional chances to enter additional strings, and each time a string is entered, the above process is to be performed. The inputting...

  • 10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string...

    10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string object arguments. Let's call them string1, string2, and string3. It should search string for all occurrences of string2. When it finds an occurrence of Programming Challenges string2, it should replace it with string. For example, suppose the three arguments have the following values: stringt: "the dog jumped over the fence" string 2 "the" string3: "that" With these three arguments, the function would return a...

  • QUESTION 6 Please match questions (definitions) with answers - A computer designed to be used by...

    QUESTION 6 Please match questions (definitions) with answers - A computer designed to be used by one person at a time, commonly connected to a LAN and run multi-user operating systems - Main residential program that coordinates all hardware and software activity and provide interface for User (GUI). A collection of information stored as one unit with one name. 1. Algorithm 2. File 3. Operating System 4. End User workstation - Sequence of connected instructions that describes behavior of any...

  • // Write a program that determines how many of each type of vowel are in an...

    // Write a program that determines how many of each type of vowel are in an entered string of 50 characters or less. // The program should prompt the user for a string. // The program should then sequence through the string character by character (till it gets to the NULL character) and count how many of each type of vowel are in the string. // Vowels: a, e, i, o, u. // Output the entered string, how many of...

  • Write your code in the file StringRec.java. For this problem, the following restrictions apply: YOUR CODE...

    Write your code in the file StringRec.java. For this problem, the following restrictions apply: YOUR CODE MUST BE RECURSIVE. Do not use loops (while, do/while, or for). Do not declare any variables outside of a method. You may declare local variables inside a method. Complete the following method: public static String decompress(String compressedText): Decompress the input text, which has been compressed using the RLE algorithm (previous hw assignment): Run-length encoding (RLE) is a simple "compression algorithm" (an algorithm which takes...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT