0% found this document useful (0 votes)
49 views13 pages

CLASSXI

The document provides detailed instructions for a Class XI computer project, outlining requirements for submission format, including the use of printed materials only and specific software for code output. It includes a series of programming tasks, each requiring the creation of classes in Java to solve various problems, such as calculating sums, checking for perfect numbers, and identifying circular primes. The project must be organized with a clear index and sections for introduction, programs, conclusion, bibliography, and acknowledgments.
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)
49 views13 pages

CLASSXI

The document provides detailed instructions for a Class XI computer project, outlining requirements for submission format, including the use of printed materials only and specific software for code output. It includes a series of programming tasks, each requiring the creation of classes in Java to solve various problems, such as calculating sums, checking for perfect numbers, and identifying circular primes. The project must be organized with a clear index and sections for introduction, programs, conclusion, bibliography, and acknowledgments.
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/ 13

CLASSXI

INSTRUCTIONS:

I. Use ribbon file/shoeless file /hard file for the project.


II. Each and every thing for this project need to printed. Hand written
projects are not accepted.
III. Both side printing is not allowed. Only right-side print.
IV. Use BlueJ software to take the printout of the source code and output in
XPS format.
Note: Screenshots are not allowed.
V. Orientation of the file:

First page: (Example of First page will be shared later on)


Name
Class
Stream
RollNo.
Session
Unique ID Leave space for Unique ID and Index No. Details
will be given later on.
IndexNo.

TERMINALPROJECT

Index
Introduction
15programs
Conclusion
Bibliography
Acknowledgement
FINALPROJECT

Index
Introduction
10 programs
Conclusion
Bibliography
Acknowledgement

Orientation of the program Question


Algorithm
Source Code
Output
Variable Description Table
VI. It’s mandatory to create separate index for both
terminal and final.
VII. Terminal and Final project will be submitted in a single file.

VIII. Use white chart paper to cover the file and


use black thin ribbon to tie the file.
ST STEPHEN’S GROUP OF SCHOOL
COMPUTER ASSIGNMENT 2023-24
CLASS XI

Question1:
A class Series has been defined to generate sum of the following series:

Some of the members of the class are given below:

Class name : Series

Data member/instance variable:

X :integer to store the value of x


N :integer to store the value of n(term)
sum :double to store the final sum

Member functions/methods:

Series() :default constructor


voidaccept() : to accept the value of x and n.
int sum(int a) :return the sum of natural numbers
up to a using recursion.
voiddisplay() : call the sum() method and compute the
sum of the series.
Specify the class Series, giving details of the Constructor, void
accept( ), int sum(int), and voiddisplay( ). Define the main( )
function to create an object and call the functions accordingly to enable
the task.

Question2:
A class Perfect has been defined to check the number is a perfect number
or not. A perfect number is a number whose sum of the factors excluding
itself is equal to the number.
For example, 6 = 1+2+3, 28 = 1+2+4+7+14 etc.
Some of the members of the class are given below:

Class name : Perfect

Data member/instance variable:

num : integer to store the number


sum : integer to store the sum of the
factors
Member functions/methods:

Perfect( ) : default constructor


void accept( ) : to accept a positive number.
int factorSum(int a) : return the sum of the factors
of the
given number using recursive technique.
void display( ) : call the factor() method and
check and print the number is
palindrome or not and print appropriate message.
Specify the class Perfect giving details of the Constructor, void accept( ),
int factorSum(int), and void display( ).Define the main( )function to
create an object and call the functions accordingly to enable the task.

Question 3:

Design a class NumDude to check if a given number is a Dudency number


or not.

(A Dudency number is a positive integer is a perfect cube , such that


the sum of its equal to the cube root of the number. )

Example : 5832 = (5+8+3+2)3 = (18)3 = 5832 , thus 5832 is a Dudency


number.

The details of the class are given below:

Class name : NumDude

Data member/instance/variable:
num : to store a positive integer number

Methods/Member functions:
NumDude() : default constructor to initialize the data member
with legal initial value
void input() : to accept a positive integer number
int sumDigits(int x) : returns the sum of the digits of number
void is Dude() : checks whether the given number is a Dudeney
number by invoking the function sumDigits() and
displays the result with an appropriate message

Specify the class NumDude giving details of the constructor(), void


input(), int sumDigits(int) and void is Dude(). Define a main() function
to create an object and call the functions accordingly to enable the task.

Question 4:
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 TRANSPOSE
9 6 7 9 12 10
12 4 1 6 4 8
10 8 2 7 1 2
Some of the members of the class are given below:
Class name : Trans

Data members/instance variable:


arr[ ][ ] : to store integers in the 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.

Question 5:
A class SortAlpha has been defined to sort the words in the sentence
in alphabetical order.
Example: Input: THE SKY IS BLUE Output:
BLUE IS SKY THE

Some of the members of the class are given below:


Class name : SortAlpha
Data members/instance variable:
sent : to store a sentence
n : integer to store the number of words in a sentence

Methods/Member functions:
SortAlpha() : default constructor to initialise data members
with legal initial value
void acceptsent() : to accept a sentence in UPPER CASE
void sort(SortAlpha P) : sorts the words of the sentence of object P in
alphabetical order and stores the sorted sentence
in the current object
void display() : display the original sentence along with the
sorted sentence by invoking the method sort()

Specify the class SortAlpha giving details of the constructor(), void


acceptsent(), void sort(SortAlpha) and void display(). Define a main()
function to create an object and call the functions accordingly to enable the
task.
Question 6:
A Fascinating number is one which when multiplied by 2 and 3 and then
after the results are concatenated with the original number , the new
number contain all the digits from 1 to 9 exactly once. There can be any
number of zeros and are to be ignored.
Example : 273
273 X 1= 273
273 X 2= 546
273 X 3 = 819
Concatenating the results we get , 273546819 which contaings all the
digits from 1 to 9 exactly once. Thus, 273 is a Fascinating number.
Accept two positive integers m and n, where m must be less then n
and the values of both m and n must be greater than 99 and less than
10000. Display all the Fascinating number that are in the range
between m and n (both inclusive) and output them along with the
frequency, in the format given below:
Test your program with the following data and some random
data:
Example 1:
INPUT : m = 100 n = 500
OUTPUT: THE FASCINATING NUMBERS ARE:
192 219 273 327
FREQUENCY OF FASCINATING NUMBERS IS : 4
Example 2:
INPUT : m = 900
n = 5000
OUTPUT: THE FASCINATING NUMBERS ARE:
1902 1920 2019 2190 2703 2730 3027 3270
FREQUENCY OF FASCINATING NUMBERS IS : 8
Example 3:
INPUT : m = 400
n = 900
OUTPUT: THE FASCINATING NUMBERS ARE: NIL
FREQUENCY OF FASCINATING NUMBERS IS : 0
Example 4:
INPUT : m = 70 n = 450
OUTPUT: INVALID INPUT
Question 7:
Write a program to accept a paragraph containing TWO sentences
only. The sentence may be terminated by either ‘.’ , ‘ ? ’ or ‘ ! ’ only. Any
other character may be ignored. The words are to be separated by a
single blank space and must be in UPPER CASE. Perform the following
tasks:
a. Check for the validity of the accepted paragraph for the number of
sentences and for terminating character.
b. Separate the two sentences from the paragraph and fid the common words
in the two sentences with their frequency of occurrence in the paragraph.
c. Display both the sentences separately along with the common words and
their frequency,
In the format given below :
Test your program with the sample data and some random
data:
Example 1:
INPUT : IS IT RAINING ? YOU MAY GET WET IF IT IS RAINING
OUTPUT: IS IT RAINING ? YOU MAY GET WET IF IT IS RAINING
COMMON WORDS FREQUENCY
IS 2
IT 2
RAINING 2

Example 2:
INPUT : INDIA IS MY MOTHERLAND AND I AM PROUD OF MY MONTHERLAND.
ALL INDIANS ARE MY BROTHERS AND SYSTER.
OUTPUT: INDIA IS MY MOTHERLAND AND I AM PROUD OF MY
MONTHERLAND. ALL INDIANS ARE MY BROTHERS AND SYSTER
COMMON WORDS FREQUENCY
MY 3
AND 2

Example 4:
INPUT : AT LAST , THE TIGER WAS SAVED.
OUTPUT: INVALID INPUT

Question 8:
Circular Prime is a prime number that remains prime under cyclic shifts of its
digits. When the leftmost digit is removed and replaced at the end of the
remaining string of digits, the generated number is still prime. The process is
repeated until the original number is reached again.
A number is said to be prime if it has only two factors 1 and itself.
Example:
131
311
113
Hence, 131 is a circular prime.
Accept a positive number N and check whether it is a circular prime or
not. The new numbers formed after the shifting of the digits should
also be displayed.
Test your program with the following data and some random data:

Example 1
INPUT:
N = 197
OUTPUT:
197
971
719
197 IS A CIRCULAR PRIME.

Example 2
INPUT:
N = 1193
OUTPUT:
1193
1931
9311
3119
1193 IS A CIRCULAR PRIME.

Example 3
INPUT:
N = 29
OUTPUT:
29
92
29 IS NOT A CIRCULAR PRIME.
Question 9:
A company manufactures packing cartons in four sizes, i.e. cartons to
accommodate 6 boxes, 12 boxes, 24 boxes and 48 boxes. Design a
program to accept the number of boxes to be packed (N) by the user
(maximum up to 1000 boxes) and display the break-up of the cartons used
in descending order of capacity (i.e. preference should be given to the
highest capacity available, and if boxes left are less than 6, an extra carton
of capacity 6 should be used.)
Test your program with the following data and some random data:
Example 1
INPUT:
N = 726
OUTPUT:
48 * 15 = 720
6*1=6
Remaining boxes = 0
Total number of boxes = 726 Total number of
cartons = 16

Example 2
INPUT:
N = 140
OUTPUT:
48 * 2 = 96
24 * 1 = 24
12 * 1 = 12
6*1=6
Remaining boxes = 2 * 1 = 2 Total
number of boxes = 140 Total number
of cartons = 6
Example 3
INPUT:
N = 4296
OUTPUT:
INVALID INPUT
Question 10:
A class Merger concatenates two positive integers that are greater than 0
and produces a newly merged integer.
Example: If the first number is 23 and the second is 764, then
the concatenated number will be 23764.
Some of the members of the class are given below:
Class name : Merger
Data members/instance variables:
n1 : long integer to store the first number
n2 : long integer to store the second number
mergNum : long integer to store the merged number

Member functions:
Merger() : constructor to initialize the data members
void readNum() : to accept the values of the data members n1 and
n2
void joinNum() : to concatenate the numbers n1 and n2 and store it
in mergNum
void show() :to display the original numbers and the merged number
with appropriate messages

Specify the class Merger giving the details of the constructor, void
readNum(), void joinNum() and void show(). Define the main()
function to create an object and call the functions accordingly to enable the
task.

Question 11:
Write a program to accept a sentence which may be terminated by either
'.', '?' or '!' only. The words are to be separated by a single blank space
and are in UPPER CASE.
Perform the following tasks:
1. Check for the validity of the accepted sentence only for the terminating
character.
2. Arrange the words in ascending order of their length. If two or more
words have the same length, then sort them alphabetically.
3. Display the original sentence along with the converted sentence.
Test your program for the following data and some random data:
Example 1:
INPUT:
AS YOU SOW SO SHALL YOU REAP.
OUTPUT:
AS YOU SOW SO SHALL YOU REAP. AS SO
SOW YOU YOU REAP SHALL
Example 2:
INPUT:
SELF HELP IS THE BEST HELP.
OUTPUT:
SELF HELP IS THE BEST HELP. IS THE BEST
HELP HELP SELF
Example 3:
INPUT:
BE KIND TO OTHERS.
OUTPUT:
BE KIND TO OTHERS. BE TO KIND
OTHERS
Example 4:
INPUT:
NOTHING IS IMPOSSIBLE#
OUTPUT:
INVALID INPUT
Question 12:
Write a program to convert decimal to hexadecimal.
Question 13:
Write a Program in Java to input a number and check whether it is a
Harshad Number Or NivenNumber or not..
Harshad Number: A Harshad number (or Niven number), is an integer
(in base 10) that isdivisible by the sum of its digits.
Question 14:
An emirp number is a number which is prime backwards and forwards.
Example: 13 and 31 are both prime numbers. Thus, 13 is an emirp
number.
Design a class Emirp to check if a given number is Emirp number or
not. Some of the members of the class are given below:
Class name : Emirp
Data members/instance variables:
N : stores the number
Rev : stores the reverse of the
number f : stores the divisor
Member functions:
Emirp(int nn) : to assign n = nn, rev = 0 and f = 2
int isprime(int x) : check if the number is prime using the recursive
technique and return 1 if prime otherwise return 0
void isEmirp() : reverse the given number and check if both the
original number and the reverse number are prime,
by invoking the function isprime(int) and display the
result with an appropriate message
Specify the class Emirp giving details of the constructor(int), int
isprime (int) and void isEmirp(). Define the main function to create
an object and call the methods to check for Emirp number.
Question 15:
A class SeriesSum is designed to calculate the sum of the following
series:
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 the number of terms
Sum :double variable to store the sum of the series
Member functions:
SeriesSum(int xx, int nn) : constructor to assign x=xx and
n=nn
double find fact(int m) : to return the factorial of m using the
recursive technique.
double find power(int x, int y) : to return x raised to the power of y
using the recursive technique.
void calculate() : to calculate the sum of the series by
invoking the recursive functions
respectively
void display() : to display the sum of the series
Specify the class SeriesSum, giving details of the constructor(int, int),
double find fact(int), double find power(int, int), void calculate()
and void display(). Define the main() function to create an object and
call the functions accordingly to enable the task.

You might also like