0% found this document useful (0 votes)
19 views4 pages

G-10 Assign 9-20

Uploaded by

fish.1212das
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)
19 views4 pages

G-10 Assign 9-20

Uploaded by

fish.1212das
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/ 4

Assignments from 9-20 For grade 10

Assignment 9: -

Write a program to accept a string. Convert the string to uppercase. 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

Assignment 10: -

Design a class to overload a function polygon() as follows


(i) void polygon(int n, char ch) — with one integer argument and one character
type argument that draws a filled square of side n using the character stored in
ch.
(ii) void polygon(int x, int y) — with two integer arguments that draws a filled
rectangle of length x and breadth y, using the symbol ‘@’.
(iii) void polygon( ) — with no argument that draws a filled an angle shown below

Assignment 11: -

Assignment 12: -

Special words are those words which starts and ends with the same letter.
Examples:
EXISTENCE
COMIC
WINDOW
Palindrome words are those words which read the same from left to right and
vice versa
Examples:
MALAYALAM
MADAM
LEVEL
ROTATOR
CIVIC
All palindromes are special words, but all special words are not palindromes.
Write a program to accept a word check and print Whether the word is a
palindrome or only special word.

Assignment 13: -

Write a program to accept a number and check and display whether it is a Niven
number or not.
(Niven number is that number which is divisible by its sum of digits).
Example:
Consider the number 126.
Sum of its digits is 1+2+6 = 9 and 126 is divisible by 9.

Assignment 14: -

Write a program to initialize the seven Wonders of the World along with their
locations in two different arrays. Search for a name of the country input by the
user. If found, display the name of the country along with its Wonder, otherwise
display “Sorry Not Found!”.
Seven wonders — CHICHEN ITZA, CHRIST THE REDEEMER, TAJMAHAL,
GREAT WALL OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM
Locations — MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY
Example — Country Name: INDIA Output: INDIA-TAJMAHAL
Country Name: USA Output: Sorry Not Found!

Assignment 15: -

Write a program in Java to accept a string. Arrange all the letters of the string in
an alphabetical order.
Sample Input:
computer
Alphabetical order:
cemoprtu

Assignment 16: -

Assignment 17: -

Assignment 18: -

Analyse the following program segment and determine how many times the loop
will be executed and what will be the output of the program segment?
int p= 200;
while(true)
{
if(p<100)
break;
p=p-20;
}
System.out.println(p);

Assignment 19: -

Design a class to overload a function compared as follows :


(a) void compare(int, int) — to compare two integer values and print the greater
of the two integers.
(b) void compare(char, char) — to compare the numeric value of two characters
and print the character with higher numeric value.
(c) void compare(String, String) — to compare the length of the two strings and
print the longer of the two.

Assignment 20: -

Write a program to initialize the given data in an array and find the minimum ;
and maximum values along with the sum of the given elements.
Numbers : 2 5 4 1 3
Output :
Minimum value : 1
Maximum value: 5
Sum of the elements : 15

You might also like