0% found this document useful (0 votes)
7 views1 page

String Program

The document outlines several programming tasks, including class design for function overloading to execute various operations such as finding prime numbers, character search in strings, and converting strings to piglatin. It also includes programs for string manipulation, such as changing case, counting double letter sequences, and combining strings. Additionally, it specifies tasks for formatting strings and counting specific word occurrences based on given criteria.

Uploaded by

sandipkaranjai
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

String Program

The document outlines several programming tasks, including class design for function overloading to execute various operations such as finding prime numbers, character search in strings, and converting strings to piglatin. It also includes programs for string manipulation, such as changing case, counting double letter sequences, and combining strings. Additionally, it specifies tasks for formatting strings and counting specific word occurrences based on given criteria.

Uploaded by

sandipkaranjai
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 Design a class to overload a function Execute( ) as follows:

void Execute(int, int) — print all prime numbers between two integers values.
void Execute (String, char) — Search a character in a string and print its index if found.
void Execute (String) — print the string in piglatin format.
2 Write a program to accept a word and convert it into lower case, if it is in upper case. Display the new word by
replacing only the vowels with the letter following it.
Sample Input: computer
Sample Output: cpmpvtfr
3 Write a program to accept a string. Convert the string into upper case letters. Count and output the number of
double letter sequences that exist in the string.
Sample Input: "SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE"
Sample Output: 4
4 Design a class to overload a function Joystring( ) as follows:
void Joystring(String s, char ch1, char ch2) with one string argument and two character arguments that replaces the
character argument ch1 with the character argument ch2 in the given String s and prints the new string.
Example:
Input value of s = "TECHNALAGY"
ch1 = 'A'
ch2 = 'O'
Output: "TECHNOLOGY"
void Joystring(String s) with one string argument that prints the position of the first space and the last space of the
given String s.
Example:
Input value of s = "Cloud computing means Internet based computing"
Output:
First index: 5
Last Index: 36
void Joystring(String s1, String s2) with two string arguments that combines the two strings with a space between
them and prints the resultant string.
Example:
Input value of s1 = "COMMON WEALTH"
Input value of s2 = "GAMES"
Output: COMMON WEALTH GAMES
(Use library functions)

5 Write a program in Java to accept a string in lower case and change the first letter of every word to upper case.
Display the new string.
Sample input: we are in cyber world
Sample output: We Are In Cyber World
6 Write a program to input a sentence and convert it into uppercase and count and display the total number of words
starting with a letter 'A'.
Example:
Sample Input: ADVANCEMENT AND APPLICATION OF INFORMATION TECHNOLOGY ARE EVER CHANGING.
Sample Output: Total number of words starting with letter 'A' = 4
7 Define a class to accept two strings of same length and form a new word in such a way that, the first character of the
first word is followed by the first character of the second word and so on.
Example :
Input string 1 – BALL
Input string 2 – WORD
OUTPUT : BWAOLRLD

You might also like