0% found this document useful (0 votes)
4 views

Computer Project for Class XI

The document outlines a computer project that includes acknowledgments, an index, and several programming tasks related to Hamming numbers, snowball strings, date calculations, Goldbach numbers, and friendly numbers. Each task includes a description, input/output examples, and requirements for the program. The project aims to enhance research and programming skills while providing practical coding exercises.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Computer Project for Class XI

The document outlines a computer project that includes acknowledgments, an index, and several programming tasks related to Hamming numbers, snowball strings, date calculations, Goldbach numbers, and friendly numbers. Each task includes a description, input/output examples, and requirements for the program. The project aims to enhance research and programming skills while providing practical coding exercises.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Acknowl

edgeme
nt
I would like to express my special
thanks of gratitude to my teacher Mr.
Atul Kumar Sinha as well as our Senior
Principal Ms. Jyoti Kashyap and
Principal Ms Shivani Singh who gave
me the golden opportunity to do this
wonderful Computer project which also
helped me in doing a lot of Research
and I came to know about so many new
things I am really thankful to them.
Secondly I would also like to thank my
parents and friends who helped me a lot
in finalizing this project within the
limited time frame.

Computer
Project
Name:………………..
….

Class:……Sec…..
Internal
Examiner’s sign:
___________________

External
Examiner’s sign:
____________________

Index
S.No. Program Page No.
P1 Hamming Number
P2 Snowball string
Question 1

Hamming numbers are positive integer numbers whose prime factors include 2,3 and
5 only Example:
n=6 is an hamming number as 6=2x3 .So its prime factors are
limited to 2 ,3 n=8 is an hamming number as 8=2x2x2 and it has
only 2 as its prime factors
n=90 is an hamming number as 90=2x3x3x5 which has only 2,3,5 as
prime factors n=14 is not a hamming number as 14=2x7 .It has 7 as
one of its prime factor
n=44 is not a hamming number as 44=2x2x11. It has 11 as one of its prime factors
Design a program to accept any positive integer number and check if it is a
Hamming number or not. Display the result with an appropriate message in the
format specified below. The program should also generate error message if a
negative number is entered.
Test your program for the following data and some random data.
Example 1
INPUT: Enter any number: 3600

OUTPUT: 3600= 2 x 2 x 2 x 2 x
3 x 3 x 5 x 5 3600 IS
A HAMMING
NUMBER
Example 2
INPUT: Enter any number: 5832

OUTPUT: 5832= 2 x 2 x 2 x 3 x 3 x 3 x 3 x 3 x 3
5832 IS A HAMMING NUMBER

Example 3
INPUT: Enter any number: 7854

OUTPUT: 7854= 2 x 3 x 7 x 11 x 17

7854 IS NOT A HAMMING NUMBER


Example 4
INPUT: Enter a number: -120

OUTPUT: NEGATIVE NUMBER ENTERED. INVALID INPUT

Question 2

A snowball string is a sentence where each word is arranged in ascending order of


their length and is also consecutive.

Length of
word I is 1
Length of
word am is 2
Length of
word the is 3
Length of
word Lord is
4
The length of each word is one more than the previous word. Hence they are consecutive
and in ascending order.
Write a program to enter any sentence and check if it is a snowball string or not. The
words in the sentence may be separated by a one or more spaces and terminated by .
or ? only. The program will generate appropriate error message for any other
terminating character.
Test your program for the following data and some random data:
Example 1
INPUT: He may give bonus.

OUTPUT: IT IS A SNOWBALL STRING

Example 2
INPUT: Is the cold water frozen?

OUTPUT: IT IS A SNOWBALL STRING

Example 3
INPUT: Look before you leap.

OUTPUT: IT IS NOT A SNOWBALL STRING

Example 4
INPUT: The child is father of the man!
OUTPUT: INCORRECT TERMINATING CHARACTER. INVALID INPUT

Question 3

Write a program in JAVA to accept day number (between 1 and 366) and
year (yyyy) from the from the user and display the corresponding
date.also accept ‘N’ from the user where (1<=N<=100) to compute and
display the future date ‘N’ days after the givne date. Display the error
message if the the value of the day number or ‘N’ are not within the limit.
Day number is calculated taking 1st January of the given year as 1

Test your program with given set of data and some random data

Example 1
INPUT: DAY NUMBER: 50
YEAR: 2023
N: 25
OUTPUT: ENTERED DATE: FEBRUARY 19, 2023

25 DAYS LATER: MARCH 16, 2023

Example 2
INPUT: DAY NUMBER: 321

YEAR: 2023
N: 77
OUTPUT: ENTERED DATE: NOVEMBER 17, 2023

77 DAYS LATER: FEBRUARY 2, 2024

Example 3
INPUT: DAY NUMBER: 400

YEAR: 2023
N: 125
OUTPUT: INCORRECT DAY NUMBER

Question 4
Question 5

Question 6

Question 7
Question 8

Write a program in JAVA to accept day number (between 1 and 366) and year (yyyy) from
the user and display the corresponding date. Also accept ‘N’ from the user where
(1<=N<=100) to compute and display the future date ‘N’ days after the given date. Display
error message if the value of the day number or ‘N’ are not within the limit. Day number is
calculated taking 1st January of the given year as 1.
Test your program with given set of data and some random data

Example 1
INPUT: DAY NUMBER: 50
YEAR: 2024
N: 25
OUTPUT: ENTERED DATE: FEBRUARY 19, 2024
25 DAYS LATER: MARCH 15, 2024

Example 2
INPUT: DAY NUMBER: 321
YEAR: 2024
N: 77
OUTPUT: ENTERED DATE: NOVEMBER 16, 2024
77 DAYS LATER: FEBRUARY 1, 2025

Example 3
INPUT: DAY NUMBER: 400
YEAR: 2024
N: 125
OUTPUT: INCORRECT DAY NUMBER
INCORRECT VALUE OF ‘N’

Question 9
Question 10

Question 11
Question 12
Question 13
Question 14

A number is said to be a Goldbach number, if the number can be expressed as the addition of
two odd prime number pairs. If we follow the above condition, then we can find that every
even number larger than 4 is a Goldbach number because it must have any pair of odd prime
number pairs.
Example: 6 = 3,3 ( ONE PAIR OF ODD PRIME )
10 = 3,7 and 5 , 5 ( TWO PAIRS OF ODD PRIME )
Write a program to enter any positive EVEN natural number ‘N’ where (1<=N<=50) and
generate odd prime twin of ‘N’
Test your program for the following data and some random data.

Example 1
INPUT: N = 14
OUTPUT: ODD PRIME PAIRS ARE: 3, 11
7, 7
Example 2
INPUT: N = 20
OUTPUT: ODD PRIME PAIRS ARE: 17, 3
13, 7
Example 3
INPUT: N = 44
OUTPUT: ODD PRIME PAIRS ARE: 41, 3
37, 7
31, 13
Example 4
INPUT: N = 25
OUTPUT: INVALID INPUT

Question 15
A Friendly number is a number the eventual sum of the digits of the number is equal to 9.
For Example: 675 = 6 +7+5 = 18
18 = 1+ 8 = 9
As the final sum of the digits of the number 675 is 9 so it is a Friendly number. Some more
Friendly numbers can be 9, 18, 54, 243 etc.
Design a class Friendly to check if a given number is a Friendly number or not. Some of the
member functions of the class are given below.
Class name : Friendly
Data member
Num : to store the number
Member Functions
Friendly ( int n) : to assign value of n to Num

int sumOfDigits(int nn) : Returns the sum of the digits

boolean isFriendly( int x ) : returns true if the number is Friendly by calling


the function sumOfDigits(int) otherwise returns false.

void display() : display appropriate message “Number is a


Friendly number” OR “Number is not a Friendly
number” by calling the function isFriendly(int)

Write the main( ) function to create object for the class and call functions.

You might also like