Computer Project 12th UPDATE
Computer Project 12th UPDATE
PROJECT
2024-2025
ACKNOWLEDGEMENT
I would like to express my special thanks of
gratitude to my teacher Mr. Sanjay Kumar
Shah as well as our principal Mrs. Bharti
Vishnoi, who gave me this opportunity to do
this wonderful project , which help me to
learn a lot in the research and course of
completion of the this project.
SARTHAK BHAGAT
CLASS- XII-A
___________ ___________
Sarthak Bhagat XII-A 4
Signature of Signature of
Internal examiner External examiner
INDEX
VARIABLE DESCRIPTION: -
S.no VARIABLE TYPE USE
1. a String To store num in String form
2. l Int To store length of the String
3. t int Used as a Testing Variable
4. i int Loop control Variable
5. j int Loop Control Variable
Sarthak Bhagat XII-A 10
6. num int Store the no to be checked
7. n int Store the no to be checked
8. c int To store the result
Q2 Write a program to determine how many Kaprekar numbers are there in the range
between 'p' and 'q' ( p and q are <1000) and output them also print the numbers.
VARIABLE DESCRIPTION:-
S.no VARIABLE TYPE USE
1. a int To store the limit
2. b int To store the limit
3. i int Loop control Variable
4. j int Loop control variable
5 left int To store left part of number
6. right int To store right part of the number
Q3 Write a program to input an integer number and check the given number is a
‘Magic Number’ or not. A number is a magic number, if sum of all digits of the number
is equal to 1 and the number itself a single digit number.( i.e. keep adding the digits of
the number itself till it becomes a single digit number) If sum is one the number is a
magic number otherwise number is not a magic number. Example:- 55 = 5 + 5 =10,10 =
1 + 0 = 1 Hence, 55 is a magic number.
Ex2 : - INPUT= 78
VARIABLE DESCRIPTION: -
Sarthak Bhagat XII-A 18
S.no VARIABLE TYPE USE
1. n int To store the number
2. x int To store the copy of the number
3. sum int To store the sum of square of digits
4. r int To store the digit
Q5 Write a program which inputs a positive natural number N and Prints the possible
consecutive number combinations, which when added give N.
A positive natural number (for e.g. 27) can represented as follows: 2+3+4+5+6+7 =27 ,
8+9+40=27 , 13+14=27
character may be ignored. The words may be separated by more than one blank space
and are in UPPER
(a) Accept a sentence and remove all the extra blank space between two words to a
single blank space.
(b) Accept any word from the user along with its position and insert the word in the
given position. (The position is calculated by place value of each word where first word
is in position 1, second word in position 2 and so on).
VARIABLE DESCRIPTION: -
S.no VARIABLE TYPE USE
Sarthak Bhagat XII-A 24
1. word String To store the word
2. sentence string To store the Sentence
3. position int To store the position
4. temporary int Temporary Variable
rows and ‘N’ is the number of columns such that both M and N must be greater than 2
and less than
10. Allow the user to input integers into this matrix. Display appropriate error message
for an invalid
input.
(c) Calculate the sum of the four corner elements of the matrix and display.
Q8 Write a program to declare a square matrix M[][] of order ‘N’. Check if the matrix
is a Doubly Markov
matrix or not. A matrix which satisfies the following conditions are Doubly Markov
matrix
Accept ‘N’ from the user where 3 <= N <= 9. Display an appropriate error message if
‘N’ is not in the given range or the entered numbers are negative. Allow the user to
create a matrix and check whether the created matrix is a Doubly Markov matrix or
not.
VARIABLE DESCRIPTION:-
S.no VARIABLE TYPE USE
1. n int To store the size of array
Q9 Write a program to input any string find the shortest and the longest word present
in a sentence and print them along with their lengths.
VARIABLE DESCRIPTION:-
S.no VARIABLE TYPE USE
1. str String To store the String
2. word Sring To store the Word
3. Lword String To store the longest Word
4. sword String To store the shortest word
5. i int Loop Control Variable
6. len int To store the length of the String
7. ch char To store the character
Q11 : Write a Java program to enter any number between 2 to 5( both inclusive) and
print all the unique combinations of the digits between 1 to that number. There should
be one blank space between each digit and each new combination should appear on
new line. Also display the total number of combinations formed for the given input.
VARIABLE DESCRIPTION: -
S.no VARIABLE TYPE USE
1. num1 int To store the first number
2. num2 int To store the second number
METHODS
Q12 A class Adder has been defined to any two accepted Time.
Member functions/methods:
Void addTime(Adder X, Adder Y) : adds the time to the two parametrized objects X
and Y and stores the sum in the calling objects.
Specify the class Adder giving the details of the constructor( ), void readTime(),void
addTime(Adder,Adder) and void dispTime().
Define the main() function to create objects and call the function accordingly to enable
the task.
VARIABLE DESCRIPTION: -
S.no VARIABLE TYPE USE
1. a[] int Array to store the time
Q13 A class Mixer has been defined to merge two sorted integer arrays in ascending
order. Some of the details of the class are given below:
Member functions/method:
void accept( ) : to accept the elements of the array in ascending order without any
duplicates
Mixer mix(Mixer A) : to merge the current object's array elements with the
parameterized array elements and return the resultant object
Specify the class Mixer, giving details of the constructor(int), void accept( ), Mixer
mix(Mixer) and void displav(). Define the main( ) function to create an object and call
the function accordingly to enable the task.
VARIABLE DESCRIPTION:-
Q14 A class Numbers contains the following data members and member functions to
check for triangular numbers. [A triangular number is formed by the addition ofa
consecutive sequence of integers starting from 1].
Member function/methods
Specify the class Numbers giving details of the functions void getnum( ), int check(int)
and void
VARIABLE DESCRIPTION: -
S.no VARIABLE TYPE USE
1. n int To store the number
2. num int Formal Parameter
3. s int Counter Variable
4. mid int To store the mid term
5. i int Loop Control Variable
VARIABLE DESCRIPTION:-
S.no VARIABLE TYPE USE
1. x[] int To store elements of array
2. l int To store Lower element
3. h int To store Upper Element
4. mid int To store the middle position
5. ele int Element to be searched
N! = n*(n-1)*(n-2)*-------------*1
Member Functions/Methods:
Write the main() method to create an object to class Factorial and call the functions
get(int).
VARIABLE DESCRIPTION: -
S.no VARIABLE TYPE USE
1. n int To store the number to find factorial
2. f int To store the factorial
3. m int To store the number
4. x int Formal Parameter
Q17 A Disarium number is a number in which the sum of digits to the power of their
respective position is equal to the number itself. Hence, 135 is a disarium number.
Design a class Disarium to check if a given number is a disarium number or not. Some
of the details of the class are given below:
Specify the class Disarium giving the details of the constructor(), void countDigit(), int
sumofDigits(int,int) and void check().Define the main Function to create an object and
call the functions accordingly to enable the task.
Q18 A Class Palin has been defined to check whether a positive number is a palindrome
number or not.
The number ‘n’ is palindrome if the original number and its reverse are same.
Specify the class Palin giving the details of the Constructor(), void accept(), int
reverse(int) and void check(). Define the main( ) function to create an object and call the
functions accordingly to enable the task.
Q19 A class Prime_Series defines a recursive function to find the prime numbers from a
list of data. The details of the class are given below:
Member Functions/Methods:
OUTPUT:-
Sample Input:
M[0] M[1] M[2] M[3] M[4] M[5] M[6] M[7] M[8] M[9]
69 45 45 25 34 540 34 41 29 16
Q21 Declare a square matrix A[][] of order MxN where ‘M’ is the number of rows and
the number of columns , such that M must be greater than 2 and less than 10 . Accept
the value of M from the user .Display an appropriate message for an invalid input .
Allow the user to input into this matrix , perform the following matrix .
Q22 Write a program to input long integer data not less than 5 digits . Your program
should reject , if data is less than 5 digits and ask to re-enter the value . In the input ,
last four digits will be taken as year (validity if the year should be checked that the year
should be in the range from 1900 to 3000 both inclusive , otherwise the computer should
reject the input and ask to re-enter data again) and remaining digits as total number of
days . your program should display the output as actual date(using number of days
extracted) followed by month name and actual year .
Test your program for the following data and some random data .
Sample output: Invalid Data! Re-enter value not less than 5 digits
Q23 A unique –digit number is a positive integer(without leading zeroes) and with no
duplicate digits . For example, 7,135,214 are all unique-digit integers whereas
33,3121,300 are not . Given two positive integers ‘a’ and ‘b’ ,write a program to
determine how many unique-digit integers are there in the range between ‘a’ and ‘b’
(both inclusive)and output them. The input contains two positive integers ‘a’ and ‘b’ .
Assume ‘a’<300 and ‘b’<500 . You are to find the number of unique-digits integers in
the specified range along with their values in the format specified below:
Sample Data:
Input m and n:
a=100 b=120
Output:
Q24 Write a program to create a Double dimensional array of order [m] x [m] (where m
represents the number of rows and columns) to store integer numbers . Now , pass the
array to a method Diagonal() which calculates the sum of left and right diagonal
elements. Finally, display the elements of the original matrix and also the sum of left
and right diagonal elements.
VARIABLE DESCRIPTION:
S.no VARIABLE TYPE USE
1. p1 int To store the length of first word
2. p2 int To store the length of second word
3. i int Loop control Variable
4. j int Loop control Variable
The ASCIl values of A, < space >, z are 65, 32, 122 respectively. Concatenate them to get
6532122, then reverse this to get 2212356 as the coded message. Write a program which
reads a coded message and decodes it. The coded message will not exceed 200
characters. It will contain only alphabets (A ........Z and a.. z) and spaces. ASCII values
of A ......... Z are 65 90 and those of a ..........z are 97........122
Test your program for the following data and some random data.
Sample Data:
VARIABLE DESCRIPTION:
S.no VARIABLE TYPE USE
1. l int To store length of word
2. k int Convert the strig to word
INHERITANCE
&
Sarthak Bhagat XII-A 106
INTERFACES
Q27 Write a class Sentence to store a sentence and another class Duplicate to replace the
duplicate characters. The details of the classes are given below:
(ii) Using the concept of inheritance, specify the class Duplicate giving the details of the
functions void removeDuplicate().
VARIABLE DESCRIPTION:
Q28 Write a program by using class Employee to store the details of an employee and
another Class Overtime to calculate the amount paid for working more than the normal
working hours. The details of the classes are given below:
Member functions/methods:
void Display() : To display empc and bpay after performing the task.
Member functions/methods :
double Calculate() : paid for extra hours. To calculate gross salary (basic salary +
salary paid for extra hours)
(i) Specify the classes Employee and Overtime by giving the details of the functions, void
Display() and void Show().
(ii) Using the concept of inheritance, specify the class Overtime giving the details of the
functions.
VARIABLE DESCRIPTION:
Sarthak Bhagat XII-A 113
S.no Variable Type Use
1. empc Int To store employee code
2. bpay double To store basic salary in double type
3. nd Int Stores the numbers of extra hours
worked
4. Rate float To store rate per hours
Q29 Product has been defined to store the details of a product sold by a sealer to a
retailer. Define a sub class Sales to compute the total amount paid by the retailer with or
without fine along with service tax.
member functions/methods:
void compute( ) : calculates the service tax @ 12.4% of the actual sale amount
calculates the fine @ 2.5%
of the actual sale amount only if the amount paid by the retailer to wholesaler exceeds
30 days.
Calculates the total amount paid by the retailer as (actual sale amount + service tax
+fine)
void show( ) : displays the data members of super class and the total amount.
Assume that the super class Product has been defined. Using the concept of
inheritance,specify the class Sales giving the details of the constructor(...), void
compute() and void show().
VARIABLE DESCRIPTION: -
S.No VARIABLE TYPE DESCRIPTION
1. Name String To store the name of product
2. code int To store the product code
3. amount Double To store the total sale amount of
DATA
STRUCTURE
Sarthak Bhagat XII-A 117
(Stacks &
Queue)
Q30 Define a class Repeat which allows the user to add elements from one end(rear) and
remove elements from the other end(front) only.
Member function/Methods
(a) Specify the class Repeat giving the details of the constructor(int), member function
void pushvalue(int), int popvalue() and void disp().
Q31 A stack is a kind of data structure which can store elements with the restriction
that un element can be added or removed from the top only.
Member functions/methods
Specify a class Stack giving details of the constructors(), void pushname(String n),
String popname() and void display().
Q32 Deque is an entity which can hold elements. The Deque data structure allows the
insertion and deletion of elements from both the ends(front and rear). The details of the
class are given below:
Member Functions/Methods
Deque(int c,int nf, int nr) : Constructor to assign ‘c’ to capc, nf to ‘F’ and nr to
‘R’ (nf gets a value –1 and nr gets a value -1).
Members functions:
CirQueue (int max) : constructor to initialize the data member cap=max, front=0 and
rear=0
void push(int n) : to add integer in the queue from the rear end if possible,
otherwise display the message "QUEUE IS FULL"
int pop() : removes and return the integer from the end of the queue if any, else
returns -9999
Specify the class CirQueue giving details of the function void push(int) and int pop().
Assume that the other functions have been defined.The main function and algorithm
need NOT to be written.
VARIABLE DESCRIPTION: -
S.no VARIABLE TYPE USE
1. maxSize int To store maximum size
2. Array int To store queue
3. front int To store front end
4. rear int To store rear end`
OUTPUT:-
WEBSITE USED:-
1. www.GeeksForGeeks.com
2. www.JavaTpoint.com
3. www.udemy.com