0% found this document useful (0 votes)
36 views2 pages

18 To 20 - X Assignments

This document contains 5 programming assignments related to string manipulation and class overloading in Java. Assignment 18 contains 5 questions involving generating patterns using switch statements, menus to display letters, reversing case of characters in a string, filtering words by starting/ending characters, and combining characters from two strings. Assignment 19 contains 3 questions about replacing vowels in a string, displaying initials and surname, and checking for palindromes. Assignment 20 contains 3 questions overloading the display() method to handle different data types and perform various string checks and outputs.

Uploaded by

myturbogames
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)
36 views2 pages

18 To 20 - X Assignments

This document contains 5 programming assignments related to string manipulation and class overloading in Java. Assignment 18 contains 5 questions involving generating patterns using switch statements, menus to display letters, reversing case of characters in a string, filtering words by starting/ending characters, and combining characters from two strings. Assignment 19 contains 3 questions about replacing vowels in a string, displaying initials and surname, and checking for palindromes. Assignment 20 contains 3 questions overloading the display() method to handle different data types and perform various string checks and outputs.

Uploaded by

myturbogames
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
You are on page 1/ 2

Name: _______________________________ Grade : X Div.

: ____________________
Roll No. : _______ Date:______________ Term : II Assignment No: 18 to 20
Subject: Computer Applications Topic: Assignment Questions
Assignment No 18:
Question 1:
Write a program to generate the following pattern using switch-case statements.
Enter 1 to display in the Enter 2 to display in an
right triangle. inverted right triangle.

Question 2:
A
AB
ABC
ABCD
ABCDE

S ABCDE
BCDE
CDE
DE
E
LH
Write a menu driven program to generate the uppercase letters from Z to A and
lowercase letters from a to z as per the user’s choice. Enter 1 to display uppercase
letters from Z to A and Enter 2 to display lowercase letters from a to z.
Question 3:
Write a class to accept a String, and print the String with the uppercase and
lowercase characters reversed, but all the other characters should remain the same
as before. SAMPLE INPUT: WelCoMe_2022
SAMPLE OUTPUT: wELcOmE_2022
Question 4:
Define a class to declare an array to accept and store 10 words. Display only those
words which begin with the letter ‘A’ or ‘a’ and also end with the letter ‘A’ or ‘a’.
Question 5:
Define a class to accept 2 strings of the 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.
Input String 1 - BALL Input string 2 - WORD Output : BWAOLRLD

Page 1
Assignment No 19:
Question 1: Write a program in Java to accept a String in upper case and replace
all the vowels present in the String with Asterisk (*) sign.
Sample Input: TATA STEEL IS IN JAMSHEDPUR
Sample output: T*T* ST**L *S *N J*MSH*DP*R
Question 2: Write a program to accept full name and display the initials along with
the surname.
SAMPLE INPUT: Mohandas Karamchand Gandhi
SAMPLE OUTPUT: M. K. Gandhi

Question 3: Define a class to accept a string, convert it into lowercase and check
whether the string is a palindrome or not. A palindrome is a word which reads the
same backward as forward. Example: madam, racecar etc.
Assignment No 20:
Question 1: Design a class overloading and a function display( ) as follows:

S
1. void display(String str, int p) with one String argument and one integer
argument. It displays all the uppercase characters if 'p' is 1 (one) otherwise, it
displays all the lowercase characters.
2. void display(String str, char chr) with one String argument and one character
argument. It displays all the vowels if chr is 'v' otherwise, it displays all the
LH
other alphabets.

Question 2: Design a class to overload a function compare( ) as follows:


1. void compare(int, int) — to compare two integers values and print the
greater of the two integers.
2. void compare(char, char) — to compare the numeric value of two characters
and print with the higher numeric value.
3. void compare(String, String) — to compare the length of the two strings and
print the longer of the two.

Question 3: Design a class to overload the function display(.....) as follows:


1. void display(String str, char ch) — checks whether the word str contains the
letter ch at the beginning as well as at the end or not. If present, print
'Special Word' otherwise print 'No special word'.
2. void display(String str1, String str2) — checks and prints whether both the
words are equal or not.
3. void display(String str, int n) — prints the character present at nth position in
the word str.

Page 2

You might also like