3rd project class X
3rd project class X
3rd project class X
3rd project
Class X
Computer Applications
2024-2025
Program No:1
Define a class RecurringPatterns and define methods in it, which will print the following
patterns using switch case.
a) The method takes an integer argument n and prints the following pattern, shown for n=4.
a
aa
aaa
aaaa
aaa
aa
a
b) The method takes an integer argument and prints the following pattern, shown for n=4.
1
121
12321
1234321
12321
121
1
Program No:2
Define a class called Library with the following description:
Instance variables/data members:
Int acc_num – stores the accession number of the book
String title – stores the title of the book stores the name of the author
Member Methods:
(i) void input() – To input and store the accession number, title and author.
(ii)void compute – To accept the number of days late, calculate and display and fine charged
at the rate of Rs.2 per day.
(iii) void display() To display the details in the following format:
Accession Number Title Author
Write a main method to create an object of the class and call the above member methods.
Program no:3
Given below is a hypothetical table showing rates of Income Tax for male citizens below the
age of 65 years:
Taxable Income (TI) in Income Tax in
Does not exceed 1,60,000 Nil
Is greater than 1,60,000 and less than or equal to 5,00,000 ( TI – 1,60,000 ) * 10%
Is greater than 5,00,000 and less than or equal to 8,00,000 [ (TI - 5,00,000 ) *20% ] + 34,000
Is greater than 8,00,000 [ (TI - 8,00,000 ) *30% ] + 94,000
Write a program to input the age, gender (male or female) and Taxable Income of a person. If
the age is more than 65 years or the gender is female, display “wrong category*.
If the age is less than or equal to 65 years and the gender is male, compute and display the
Income Tax payable as per the table given above.
Program No:4
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
Program No: 5
Program No:6
Data Members
String: name, address & city
double :salary, da, hra,pf, gs, ns
Member functions
Pay(String n, String add, String cy, Float s)-Parameterized constructor to initialize the data
members.
void outputData()-to display initial values
void calculate() to calculate following details:
da 15% of salary
hra 10% of salary
pf 12% of salary
gs salary + da + hra
ns = gs - pf
void display() to display the complete information
Program No:7
Write a program to accept a word and display the new sword after removing the vowels
present in the word. Example: COMPUTER APPLICATION --> CMPTR PPLCTNS
Program No:8
Write a program in Java to input the values of x and n and print the sum of the following
series:
S = 1 + (x+2)/2! + (2x+3)/3! + (3x+4)/4! + ……… to n terms