ComputerApp MUSTKNOW X
ComputerApp MUSTKNOW X
Section – B
1. Define a class Employee having the following description:
Data members:
String name : to store the name
double income : to store the annual taxable income double
tax : to store the tax
Member functions :
input() : to enter the pan number, name and taxable
income calc() : calculate tax of an employee
display() : output details of an employee
Write a program to compute the tax payable based on the following conditions :-
Annual income Annual tax deduction %
<= Rs. 300000 0%
Rs.300001 to Rs.500000 10% of income exceeding 300000
> Rs. 500000 20% of income exceeding 300000
Write a main method to create an object and call the methods.
2. The following program is based on the specification given below. Fill in the blanks with appropriate java
statements.
3. Write a program to accept a number and check whether it is a devil number of not. (15)
A number is devil if it has even number if 1’s present in it. E.gs. 7121, 115, 7122111 etc.
4. Design a class to overload a function volume() as follows:
(i) double volume(double r) – with radius ‘r’ as an argument, returns the volume of sphere using the
formula:
v = 4 / 3 × 22 / 7 × r3
(ii)double volume(double h, double r) – with height ‘h’ and radius ‘r’ as the arguments, returns the
volume of a cylinder using the formula:
v = 22 / 7 × r2 × h
(iii) double volume(double l, double b, double h) – with length ‘l’, breadth ‘b’ and height ‘h’ as the
arguments, returns the volume of a cuboid using the formula:
v=l×b×h
5. Write a program to accept a number and calculates the norm of a number, norm of a number is square root
of sum of squares of all digits of the number. Example: The norm of 68 is 10 6×6 + 8×8 = 36+64 = 100
square root of 100 is 10.
6. Write a program to accept two numbers and check for Amicable number (Note: Amicable number are pair
of numbers such that one is the sum of proper factors of the other. For example : 220 and 284 , since
sum of factors of 220 = 1+2+4+5+10+11+20+22+44+55+110=284
sum of factors of 284=1+2+7+71+142=220)
7. Define a class to declare a character array of size ten, accept the character into the array and perform the
following:
• Count the number of uppercase letters in the array and print.
• Count the number of vowels in the array and print.
8. Define a class to declare an array of size 20 of double datatype, accept the elements into the array and
perform the following:
• Calculate and print the sum of all the elements.
• Calculate and print the highest value of the array.
9. Write a program to accept a word in upper case and display the character with the highest ASCII value as
well as the character with the lowest ASCII value contained in it. [15]
Input: AUTOMATA
Output: Character with highest ASCII value is U and lowest ASCII value is A
10. Define a class to accept two strings, convert them into uppercase, check and display whether two strings
are equal or not, if the two strings are not equal, print the string with the highest length or print the message
both the strings are of equal length
11. Define a class to accept and store 10 strings into the array and print the strings with even number of
characters.
12. Write a program to accept the year of graduation from school as an integer value from the user. Using the
Binary Search technique on the sorted array of integers given below, output the message “Record exists”
if the value input is located in the array. If not, output the message “Record does not exist”. {1982, 1987,
1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010}
13. Write a java program to accept 10 players name with score. Find and print the highest scorer and lowest
scorer with score.
14. Write a program to accept 10 students name and arrange alphabetically using bubble sort technique.
15. Define a class to accept a word in upper case and replace each vowel found in the word by its immediate
succeeding letter and form a new string. Display the resultant string with a proper message.
16. Design a class to overload a function Joystring() as follows :
(i) void Joystring(String s, char ch1, char ch2) with one string and two character arguments that replaces the
character argument ch1 with the character argument ch2 in the given string s and points the new string
g.
Example : Input value of s =TECHNALAGY"
ch1 = 'A' , ch2 = 'O' Output : "TECHNOLOGY"
(i) 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: First Index : 5 Last Index : 36
(ii) 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"
s2 = "GAMES"
Output : "COMMON WEALTH GAMES"
17. Write a program to accept 20 integer to store in an array and arrange in descending order using selection
sort technique.
18. Write a program to accept the names of 10 countries in a single dimension string array and their famous
place in another single dimension array. Search for a name of a country input by the user in the list. If
found, display “Search Successful” and print the name of the country along with famous place, or else
display the message” Search Unsuccessful, no such country in the list”.
19. Write a program to input and store integer elements in a double dimensional array of size 4×4
and find the sum of all the elements.
7345
5461
6942
3275
Sum of all the elements: 73
20. Write a program to create 3 x 3 matrix and store first 9 natural numbers in it in the following
manner:
123
456
789
Calculate the sum of right diagonal and sum of even elements using loop.
21. Design a class to accept some integers in a matrix (double dimensional array) of size 3x3. Now,
compute and print the sum of the leading diagonal elements as well as the counter diagonal elements
separately.
Example:
If, A[ ][ ] =
254
038
457