[go: up one dir, main page]

0% found this document useful (0 votes)
2 views3 pages

2025-26 Std. 11 J Computer Holiday HW

The document outlines a series of programming assignments for a class, focusing on the creation of various classes in Java to perform specific tasks such as calculating taxes, identifying Ramjee numbers, converting decimal to octal, calculating factorials, summing series, transposing matrices, creating mirror images of matrices, sorting arrays, and performing string operations. Each assignment specifies the class structure, data members, and methods required, along with the expected output format. The document serves as a comprehensive guide for students to implement object-oriented programming concepts in Java.
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)
2 views3 pages

2025-26 Std. 11 J Computer Holiday HW

The document outlines a series of programming assignments for a class, focusing on the creation of various classes in Java to perform specific tasks such as calculating taxes, identifying Ramjee numbers, converting decimal to octal, calculating factorials, summing series, transposing matrices, creating mirror images of matrices, sorting arrays, and performing string operations. Each assignment specifies the class structure, data members, and methods required, along with the expected output format. The document serves as a comprehensive guide for students to implement object-oriented programming concepts in Java.
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/ 3

Std.

11 Holiday Homework
Question 01
Define a class Employee having the following description:
Data Members / instant variables
int pan : to store personal account number
String name : to store name
donble taxincome : to store annual taxable income
double tax : to store tax that is calculated
Member function/methods
Employee( ) : default constructor to initialize the data member
void input( ) : Store the pan number, name ,taxableincome
void calculate( ) : calculate tax for employee
void display( ) : output details of an employee
Write a program to compute the tax according to the given conditions and display the output as per given format.
Total Annual Taxable Income Tax Rate
Upto Rs. 1,00,000 No tax
From 1,00,001 to 1,50,000 10% of the income exceeding Rs. 1,00,000
From 1,50,001 to 2,50,000 Rs. 5000+20% of the income exceeding Rs. 1,50,000
Above Rs. 2,50,000 Rs. 25,000+30% of the income exceeding Rs. 2,50,000
In the main program, create an object of the type taxpayer. Calculate the tax for the taxpayer and output it in the
following format:
Pan Number Name Taxable Income Tax
XXXXXXX XXX XXXXX XXXX

Question 02
A Ramjee number is a number in which the eventual sum of the squares of the digits of the number is equal to 1.
For example:
Input: 139 = 12 + 32 + 92 = 91
91 = 92 + 12 = 82
82 = 82 + 22 = 68
68 = 62 + 82 = 100 and
100 = 12 + 02 + 02 =1
So, 139 is Ramjee.
To perform above operations a class Ramjee is declared with the following details:
Class name : Ramjee
Data members/Instant variables
N : to store the number.
Member function/methods
Ramjee( ) : constructor to assign 0 the N.
void readNum(int x) : to assign x to N.
int findPower(int s) : to return the square of s.
int sumOfSquare(int n) : to return the sum of squares of the number by invoking function findPower( ).
void isRamjee( ) : by invoking suitable function check and print if the given number is a Ramjee number
or not.
Specify the class Ramjee giving details of the constructor and the functions void readNum( ), int findPower( ), int
sumOfSquare( ) and void isRamjee( ).

Question 03
A class DeciOct has been defined to convert a decimal number to its equivalent octal number. The details of the class
are given below:
Class name : DeciOct
Data members/instance variables
n : integer to store decimal number.
oct : store the octal equivalent.
Member functions/methods
DeciOct() : constructor to assign 0 to n and oct.
void getnum(int nn) : to assign nn to n.
void deci_oct() : calculates the octal equivalent of ‘n’ and stores it in ‘oct’.
void ahow() : displays the decimal number ‘n’, calls the deci_oct() and displays its octal equivalent.
Specify the class DeciOct giving details of constructor, functions void getnum(int), void deci_oct(), and void
show(). Also define a main() function to create an object and calls the functions accordingly to enable the task.

1
Question 04
The following is the process of finding factorial of a number n.
n! = n x (n-1) x (n-2) x (n-3) x ………………….. x 1.
A class factorial is declared with the following details:
Class name : factorial
Data members/instance variables
n : (integer) to store a number >= 0.
f : (integer) to store the factorial.
Member functions/methods
factorial() : a constructor to assign 0 to n.
int fact(int num) : to find and return the factorial of num ( if num > 0), otherwise it should return 1
if num = 0.
void getnumber(int x) : to assign x to n and by invoking function fact( ) store the factorial of n
into f. Print value stored in ‘f’ using suitable message.
Specify the class factorial by giving details of constructor and all the functions. Write a main function to print the
factorial of the integer number.

Question 05
A class SeriesSum is designed to calculate the sum of the following series
sum = x2/1! + x4/3! + x6/5! +…………..+ xn/(n-1)!
Some of the members of the class are given below:
class name : SeriesSum
Data members/instance variables
x : to store an integer number
n : to store number of terms
sum : double variable to store the sum of the series
Member functions/methods
SeriesSum (int xx, int nn ) : Constructor to assign x = xx and n = nn
double findfact( int m ) : to return the factorial of m using recursive technique
double findpower (int x, int y) : to return x raised to the power of y using recursive technique
void calculate( ) : to calculate the sum of the series by invoking the recursive function respectively
void display( ) : to display the sum of the series

Specify the class SeriesSum, giving details of the constructor (int, int), double findfact(int), double findpower(int,
int), void calculate() and void display()’ Define the main() function to create an object and call the functions
accordingly to enable the task.

Question 06
A class Trans is defined to find the transpose of a square matrix. A transpose of a matrix is obtained by interchanging
the elements of the rows and columns.
Example: If size of the matrix = 3,
Then,
ORIGINAL MATRIX TRANSPOSE MATRIX
11 5 7 11 8 1
8 13 9 5 13 6
1 6 20 7 9 20
Some of the members of the class are given below:
Class name : Trans
Data members/instance variable
arr[][] : to store the elements of input matrix
tarr[][] : to store the elements of transpose matrix
m : integer to store the size of the matrix
Methods/Member functions
Trans(int mm) : parameterised constructor to initialise the data member m = mm
void fillarray() : to enter integer elements in the matrix
void transpose() : to create the transpose of the given matrix
void display() : displays the original matrix and the transport matrix by invoking the method transpose()
Specify the class Trans giving details of the constructor(), void fillarray(), void transpose() and void display().
Define a main() function to create an object and call the functions accordingly to enable the task.

2
Question 07
A class matrix_image is created with the following details:
Class name : matrix_image
Data members/instance variables
arr1[ ][ ], arr2[ ][ ] : double dimensional integer arrays of maximum size 15X15.
m, n : integers to store number of rows and number of columns.
Member functions/methods
matrix_image() : constructor to assign mm to m and nn to n as actual number of rows and columns.
void getmat() : to input matrix arr1[ ][ ] of size m x n.
void mirror_image() : to create another matrix arr2[ ][ ] of same size m, n such that arr2[ ][ ] is the mirror image
of matrix arr1[ ][ ] as:
Input Matrix(arr1) Output Matrix(arr2)
8 4 3 1 1 3 4 8
2 6 4 9 9 4 6 2
3 4 7 5 5 7 4 3
8 6 9 1 1 9 6 8
void show( ) : to display matrices arr1[ ][ ] and arr2[ ][ ].
Specify the class matrix_image by giving details of constructors and all function. Write main function.

Question 08
WAP in java to use an integer array to store 10 numbers as instant variables.
Class name : Sort
Data members/instant variable
integer : array for 10 numbers.
Member functions/methods
Sort() : default constructor to inititalize the data members
void inputdata() : to accept the 10 integers in the array numbers
void arrange() : to arrange the numbers in ascending order.
void outputdata() : to display the input and sorted arrays.

Specify the class Sort giving the details of the constructor and functions void inputdata( ), void arrange( ) and void
outputdata( ). The main functions need to be written.

Question 09
A class Data is declared to perform string operations. Some of the members of class are given below:
Class name : Data
Data members/instance variables :
str : string variable to store string.
Member functions/methods
Data() : constructor to initialize null to str.
void accept() : to read a sentence from user in Str.
void computePrint() : to print the sentence stored in Str and also print each word of the sentence in different
lines along with number of characters in each word. Print output in two columns.
Specify the class Data giving details of the constructor, functions void accept(), void computePrint() and void
display(). Write a main() function to create suitable object of Data type and call functions accordingly to print
output.

Question 10
A class stringgop is designed to handle string related operations. Some members of the class are given below:
Class name : stringgop
Data members/instance variables
txt : to store the given string of maximum length 100
Member functions/methods
stringgop( ) : a default constructor to initialize the variables.
void readstring( ) : to accept the string from user
void circulardecode( ) : to decode the string by replacing each letter by converting it to opposite case and then
by the next character in a circular way. Hence “AbZ” will be decoded as “bCa”.
Specify the class giving the details of the char case convert (int) and void circular decode() only. You may assume
that other functions are written for you.

You might also like