0% found this document useful (0 votes)
42 views48 pages

Java Programs for Grade 10 ICSE

The document outlines various programming tasks for a Java course, including defining classes, implementing algorithms, and performing calculations. It covers topics such as EvenPal numbers, spy numbers, area calculations for different shapes, and managing student data. Additionally, it includes exercises on searching, sorting, and string manipulation.

Uploaded by

koushalbhavesh
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)
42 views48 pages

Java Programs for Grade 10 ICSE

The document outlines various programming tasks for a Java course, including defining classes, implementing algorithms, and performing calculations. It covers topics such as EvenPal numbers, spy numbers, area calculations for different shapes, and managing student data. Additionally, it includes exercises on searching, sorting, and string manipulation.

Uploaded by

koushalbhavesh
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

COMPUTER APPLICATION

JAVA 2025-26

KOUSHAL BALAJI K.R


GRADE 10 B ICSE
ROLL NO. 15

1
2
1. Define a class to accept a member from user and check if it is an EvenPal number or not.(The number is said to
be EvenPal number when number is palindrome number (a number is palindrome if it is equal to its reverse) and
sum of its digits is an even number)

Example: 121-a palindrome number

Sum of the digits-1+2+3 which is an even number


Ans:

3
4
[Link] a program to accept a number and check and display whether it is a spy number or not. (A number
is spy if the sum of its digits equals the product of its digits.)

Example: consider the number 1124. sum of the digits = 1 + 1 + 2 + 4 = 8

Product of the digits = 1 * 1 * 2 * 4 = 8

Ans:

5
6
[Link] switch statement, write a menu driven program for the following:
1. To find and display the sum of the series given below:
S= x ^ 1 - x ^ 2 + x ^ 3 - x ^ 4 +x^ 5 ..........-x^ 20
(where x = 2 )
2. To display the following series:
1 11 111 1111
For an incorrect option, an appropriate error message should be displayed.

7
8
[Link] a class to overload a function area() as follows:
1. double area (double a, double b, double c) with three double arguments, returns the area of a scalene
triangle using the formula:
2
area = √(𝑠(𝑠 − 𝑎)(𝑠 − 𝑏)(𝑠 − 𝑐 ))

where s = (a + b + c) / 2
2. double area (int a, int b, int height) with three integer arguments, returns the area of a trapezium using
the formula:
area= (1/2) height (a + b)
3. double area (double diagonal1, double diagonal2) with two double arguments, returns the area of a
rhombus using the formula:
area = 1/2 (diagonal1 x diagonal2)

9
10
[Link] a class 'Salary' described as below:
Data members: Name, Address, Phone, Subject Specialisation, Monthly Salary, Income Tax
Member methods:
a. To accept the details of a teacher including the monthly salary.
b. To display the details of the teacher.
c. To compute the annual income tax as 5% of the annual salary above 21,75,000.
Write a main method to create objects of a class and call the above member methods.

11
12
[Link] a class to overload a function check() as follows:
1. void check (String str, char ch) to find and print the frequency of a character in a string.
Example: Input:
str = "success"
ch = 's'
Output: number of s present is = 3
2. 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

13
14
[Link] a program to assign a full path and file name as given below. Using library functions, extract and
output the file path, file name and file extension separately as shown.
Input
C:\Users\admin\Pictures\[Link]
Output
Path: C:\Users\admin\Pictures\
File name: flower
Extension: jpg

15
16
[Link] a class named Student described as below:
Data members/instance variables: name, age, m1, m2, m3 (marks in 3 subjects), maximum, average.
Member methods
a.A parameterized constructor to initialize the data members (name, age, m1, m2, m3)
[Link] accept the details of a student.
[Link] compute the average and the maximum out of three.
[Link] display the name, age, marks in 3 subjects, maximum and average.
Write a main () method to create an abject of a class and call the above member methods.

17
18
[Link] a class ElectricBill with the following specifications: class: ElectricBill
Instance variables / data member: String n to store the name of the customer
int units to store the number of units consumed , double bill to store the amount to be paid
Member methods:
void accept() to accept the name of the customer and number of units consumed
void calculate() - to calculate the bill as per the following tariff:
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.
void print() - To print the details as follows:
Name of the customer:
Number of units consumed:
Bill amount:
Write a main met hod to create an object of the class and call the above member methods.

19
20
[Link] a program to input forty words in an array. Arrange these words in descending order of alphabets,
using selection sort technique. Print the sorted array.

21
22
[Link] a class that contains 5 arrays to store roll_no, name and marks in 3 subjects for 10 students. Calculate the
average and grade on the basis of the given criteria.: Average>=80 A >=60 B >=50 C else D . Print the result in the
given format:
Rollno Student Name Average Grade
1 ABC 92 A 2 XYZ 78 B Define main() and perform all the operations.

23
24
25
12. Write a program to perform Linear/Sequential search in an array of 10 elements. Enter the key value. If
found then print “Element found” else “Element not Found”

26
27
13. Write a program to compute the ASCII code of each letter of an entered string

28
29
14. Take a String array of 10 elements. Enter 10 names and calculate the number of vowels and consonants
in each name. Print the result in the given format:
Name No. Of Vowels No. of Consonants
JAVA 2 2

30
31
15. Define a class to declare an array of size twenty of double datatype, accept the elements into the array
and perform the following:
Calculate and print the product of all the elements.
Print the square of each element of the array.

32
33
16. Write a method to accept a name as parameter and print the initial first
and then the title. EXAMPLE : Parameter: LAL BAHADUR SHASTRI
Output : L. B. SHASTRI

34
35
36
[Link] a class to perform binary search on a list of integers given below, to search for an element input
by the user, if it is found display the element along with its position, otherwise display the message
"Search element not found".
2, 5, 7, 10, 15, 20, 29, 30, 46, 50

37
38
[Link] 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'
Sample Input:
ADVANCEMENT AND APPLICATION OF INFORMATION TECHNOLOGY ARE EVER CHANGING.
Sample Output: Total number of words starting with letter A = 4

39
40
19. Write a method to accept a word and print it in the following way: Parameter-> COMPUTER (a) Output-
>C (b) COMPUTER
CO COMPUTE
COM COMPUT
COMP COMPU
COMPU COMP
COMPUT COM
COMPUTE CO
COMPUTER C

41
42
[Link] a program to input a number and print whether the number is a special
number or not. (A number is said to be a special number, if the sum of the factorial of the digits of the
number is same as the original number).
Example:
145 is a special number, because 1! + 4! + 5! = 1 + 24 + 120 = 145 (Where! stands for factorial of the number
and the factorial value of a number is the product of all integers from 1 to that number, example 5!
1*2*3*4*5=120)

43
44
45
46
47
48

You might also like