COMPUTER APPLICATIONS :
Assignment :-
1. On the first page print your name, class, section, prepared by,
submitted to and Subject name neatly
2. Please number all the pages.
3. Margins to be added
4. Print in A4 size paper.
5. Print the Acknowledgement.
6. Print the Index neatly.
7. 20 programs will be given from all the chapters and it should
be printed along with the comments.
8. After each program write variable description table and the
sample input and output.
9. Spiral Binding has to be done.
10. Assignment should be submitted on 5th October, 2025
Computer Application Board Assignments and Board Project
1. Define a class ElectricBill with the following specifications:
class : ElectricBill
Instance Variable/ data member :
i. String n- to store the name of the customer
ii. int units – to store the number of units consumed
iii. double bill- to store the amount to be paid
Member methods:
i) void accept() – to accept the name of the customer and
number of units consumed
ii) void calculate() – to calculate the bill as per the following
tariff :
Number of units Rate per unit
First 100 units Rs.2.00
Next 200 units Rs.3.00
Above 300 units Rs.5.00
A surcharge of 2.5% charged if the number of units consumed is
above 300 units.
iii) void print()- To print the details as follows :
Name of the customer……………………….
Number of units consumed………………….
Bill amount…………………………………..
Write a main method to create an object of the class and call the
above member methods.
2. Write a menu driven program
a) To accept a number and check the number is a Harshad number or
not.
A number is said to be the Harshad number if it is divisible by the
sum of its digit.
For example, if number is 156, then sum of its digit will be 1 + 5 + 6 =
12. Since 156 is divisible by 12. So, 156 is a Harshad number.
Some of the other examples of Harshad number are 8, 54, 120, etc.
b) To accept a number and check the number is perfect or not. If the
sum of its positive divisors excluding the number itself is equal to
that number is a perfect number. For e.g. 28 is a perfect number
because 28 is divisible by 1+2+4+7+14=28
3. Define a class named MovieMagic with the following description:
Instance variables/data members:
int year – to store the year of release of a movie
String title – to store the title of the movie.
float rating – to store the popularity rating of the movie.
(minimum rating = 0.0 and maximum rating = 5.0)
Member Methods:
(i) movieMagic(): Default constructor to initialize numeric data
members to 0 and String data member to “”.
(ii) void accept(): To input and store year, title and rating.
(iii) void display(): To display the title of a movie and a message based
on the rating as per the table below:
Rating Message to be displayed
0.0 to 2.0 Flop
2.1 to 3.4 Semi-hit
3.5 to 4.5 Hit
4.6 to 5.0 Super Hit
Write a main method to create an object of the class and call the
above member methods.
4. Design a class to overload a function Sum( ) as follows:
(i) int Sum(int A, int B) – with two integer arguments (A and B)
calculate and return sum of all the even numbers in the range of A
and B.
Sample input: A=4 and B=16
Sample output: sum = 4 + 6 + 8 + 10 + 12 + 14 + 16
(ii) double Sum( double N ) – with one double arguments(N) calculate
and return the product of the following series:
sum = 1.0 x 1.2 x 1.4 x …………. x N
(iii) int Sum(int N) - with one integer argument (N) calculate and
return sum of only odd digits of the number N.
Sample input : N=43961
Sample output : sum = 3 + 9 + 1 = 13
Write the main method to create an object and invoke the above
methods.
5. Write a program to input forty words in a single dimension array.
Arrange these words in
descending order of letters by using ‘Selection sort’ technique. Print
the sorted array.
Sample input: Delhi, Bengaluru, Agra, Mumbai, Kolkata
Sample output: Mumbai, Kolkata, Delhi, Bengaluru, Agra
6. Write a program to input name and percentage of 35 students of
class X in two separate one dimensional arrays. Arrange students
details according to their percentage in the descending order using
bubble sort method. Display name and percentage of first ten
toppers of the class.
7. Write a program to input and store integer elements in a double
dimensional array of size 3×4 and find the sum of all the elements.
734
546
694
Sum of all the elements: 4 and Sum of diagonal elements : 14
8. Write a menu-driven program for the following pattern:
i) 1
12
123
1234
12345
ii) 1234567
123456
12345
1234
123
12
1
9. Design a class to overload a function check( ) as follows:
(i) void check (String str , char ch ) - to find and print the frequency of
a character in a string.
Example :
Input: Output:
str = "success" number of s present is =3
ch = 's'
ii) void check(String s1) - to display only vowels from string s1, after
converting it to lower case.
Example :
Input:
s1 ="computer" Output : o u e
10.
i) Write a program to input a number and check whether the number
is a disarium number or not:
A number is said to be the Disarium number when the sum of its digit
raised to the power of their respective positions is equal to the
number itself.
e.g. 11 + 72 + 53 = 1 + 49 + 125 = 175. Some other examples are 89,
175, 518
ii) Write a java program to check whether the number taken from
user is a happy number or a unhappy number. The happy number
can be defined as a number which will yield 1 when it is replaced by
the sum of the square of its digits repeatedly. If this process results in
an endless cycle of numbers containing 4, then the number is called
an unhappy number.
For example, 32 is a happy number as the process yields 1 as follows:
32 + 22 = 13
12 + 32 = 10
12 + 02 = 1
Some of the other examples of happy numbers are 7, 28, 100, 320
and so on.The unhappy number will result in a cycle of 4, 16, 37, 58,
89, 145, 42, 20, 4, … To find whether a given number is happy or not,
calculate the square of each digit present in number and add it to a
variable sum. If resulting sum is equal to 1 then, given number is a
happy number. If the sum is equal to 4 then, the number is an
unhappy number. Else, replace the number with the sum of the
square of digits.
11. Write a program to accept the year of graduation from school as
an integer value from the user. Using 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, 2003, 2006, 2007, 2009,2010}
12. Write a program to take a word as input and convert it into Pig
Latin word. A Pig Latin is an encrypted word in English, which is
generated by doing following alterations:
The first vowel occurring in the input word is placed at the start of
the new word along with the remaining alphabets of it. The
alphabets present before the first vowel are shifted at the end of the
new word followed by “ay”.
Example:
Input : s = “paris”
Output : arispay
13.Write a program to store the numbers in two different 2D Arrays
m[4][4] and n[4][4].
Find the sum of the numbers of the corresponding elements of the
two arrays m and n
and store them in the array p[4][4] by using Input statement.
Display the elements of array
p in a matrix form.
Array m Array n Array p
12 23 33 22 8 22 31 15 20 45 64 37
20 31 44 10 11 16 30 26 31 47 74
36
10 25 14 8 10 17 25 33 20 42 39 41
41 52 24 12 12 24 21 32 53 76 45
44
14. Special words are those words which starts and ends with the
same letter. [15]
Examples:
EXISTENCE
COMIC
WINDOW
Palindrome words are those words which read the same from left to
right and vice-versa.
Example:
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.
15.Define a class called BookFair with the following specifications:
Instance variables or data members:
String BName: stores the name of the book
double price: stores the price of the book
Member methods:
i) BookFair() : Parameterized Constructor to initialize data members
ii) void calculate() : to calculate the price after discount. Discount is
calculated based on the following.
Price Discount
Less than or equal to Rs. 1000 2%
of price
More than Rs. 1000 and less than or equal to Rs. 3000
10% of price
More than Rs. 3000
15% of price
iii) void display() : to display the name and price of the book after
discount.
Write a main method to create an object of the class and call the
above member methods.
16) A Dudeney number is a positive integer that is a perfect cube
such that the sum of its digits is equal to the cube root of the
number. Write a program to input a number and check and print
whether it is a Dudeney number or not.
Example:
Consider the number 512.
Sum of digits = 5 + 1 + 2 = 8
Cube root of 512 = 8
As Sum of digits = Cube root of Number hence 512 is a Dudeney
number.
17) Write a program to accept name and total marks of N number of
students in two single subscript arrays name[ ] and totalmarks[ ].
Calculate and print:
(a) The average of the total marks obtained by N number of students.
[average = (sum of total marks of all the students)/N]
(b) Deviation of each student's total marks with the average.
[deviation = total marks of a student - average]
18) Write a program in Java to accept 20 numbers in a single
dimensional array arr[20]. Transfer and store all the even numbers in
an array even[ ] and all the odd numbers in another array odd[ ].
Finally, print the elements of both the arrays.
19) Write a program in Java to accept a name(Containing three
words) and display only the initials (i.e., first letter of each word).
Sample Input: Mohan Kumar Sharma
Sample Output: M K S
20) Write a program to input a sentence. Find and display the
following:
(i) Number of words present in the sentence
(ii) Number of letters present in the sentence
Assume that the sentence has neither include any digit nor a special
character.