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

Computer File

Uploaded by

parasharaarna2
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Computer File

Uploaded by

parasharaarna2
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

SACRED HEART CONVENT HIGHER


SECONDARY SCHOOL, MATHURA

PROJECT FILE
[COMPUTER APPLICATIONS]

(SESSION : 2023-2024)
(In the fulfillment of Board Examinations)

Name : Aarna Parashar

Class & Section: 11th - A

Class Roll Number : 01

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

INDEX

Sr. No. Program


Certificate

Acknowledgement

1. Write a program to Program to generate school report card

2. Write a program to find and print prime palindrome number

3. Write a program to calculate sum of two binary numbers

4. Write a program to sum of array elements

5. Write a program to search the desired

6. Write a program to rearrange values in ascending order

7. Write a program to find lucky number

8. Write a program to check and print twin prime number

9. Write a program to print time in words

10. Write a program to generate anagram

11. Write a program of sequence numbers

12. Write a program to find and print unique digit number

13. Write a program to check and print smith number

14. Write a program of kaprekar numbers

15. Write a program to denomination of money

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

16. Write a program to calculate sum of binary numbers

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

CERTIFICATE

This is to certify that Aadya Chaudhary of class X-A has completed the project
of Computer Applications under my guidance. This is entirely her own work.

Student’s Name Teacher’s


Name

Aarna Parashar Mr. Girish

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

ACKNOWLEDGEMENT

It is my pleasure and proud privilege to place on record my deep and sincere


gratitude to the Almighty, my parents and my teachers who have been a source
of constant support to me throughout the project.

A special word of appreciation for my friend, for helping me in one way or the
other.

Student’s Name

Aarna Parashar

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

Ques. 1: Write a program to Program to generate school report card

Solution:

import java.util.*;

class q1

int rollno,physics,chem,math;

String name,email;

public static void main(String...args)

Student s1=new Student();

Scanner sc=new Scanner(System.in);

System.out.print("Roll no. : ");

s1.rollno=sc.nextInt();

System.out.print("Name : ");

s1.name=sc.next();

System.out.print("Email : ");

s1.email=sc.next();

System.out.println("Enter the Marks following...");

System.out.print("Physics : ");

s1.physics=sc.nextInt();

System.out.print("Chemistry : ");

s1.chem=sc.nextInt();

System.out.print("Math : ");

s1.math=sc.nextInt();
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

int total=s1.physics+s1.chem+s1.math;

int avg=(total*100)/300;

String grade;

if(avg<33)

grade="Fail";

else if ( avg >=34 && avg <= 44 )

grade="III";

else if ( avg >= 45 && avg <= 59 )

grade="II";

else if ( avg >=60 && avg <= 74 )

grade="I";

else

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

grade="Distinction";

//Report card..

System.out.println("\n***Report Card***");

System.out.println("Roll no. : "+s1.rollno);

System.out.println("Name : "+s1.name);

System.out.println("Email : "+s1.email);

System.out.println("Physics : "+s1.physics);

System.out.println("Chemistry: "+s1.chem);

System.out.println("Math : "+s1.math);

System.out.println("Total : "+total);

System.out.println("Average : "+avg);

System.out.println("Grade : "+grade);

Ques. 2: Write a program to find and print prime palindrome number.

Solution:

public class q2 {

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

// Function to add two binary strings

static String add_Binary(String x, String y)

int num1 = Integer.parseInt(x, 2);

// converting binary string into integer(decimal

// number)

int num2 = Integer.parseInt(y, 2);

// converting binary string into integer(decimal

// number)

int sum = num1 + num2;

// Adding those two decimal numbers and storing in

// sum

String result = Integer.toBinaryString(sum);

// Converting that resultant decimal into binary

// string

return result;

// Main driver method

public static void main(String args[])


Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

String x = "011011", y = "1010111";

System.out.print(add_Binary(x, y));

Ques. 3: Write a program to calculate sum of two binary numbers.

Solution:

public class PrimePalindrome {

public static void main(String[] args) {

int limit = 1000; // Maximum number to check for prime palindrome

System.out.println("Prime Palindromes up to " + limit + ":");

for (int i = 2; i <= limit; i++) {

if (isPrime(i) && isPalindrome(i)) {

System.out.println(i);

// Check if a number is prime


Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

public static boolean isPrime(int num) {

if (num <= 1) {

return false;

for (int i = 2; i <= Math.sqrt(num); i++) {

if (num % i == 0) {

return false;

return true;

// Check if a number is a palindrome

public static boolean isPalindrome(int num) {

int temp = num;

int reversedNum = 0;

while(temp != 0) {

int digit = temp % 10;

reversedNum = reversedNum * 10 + digit;

temp /= 10;

return num == reversedNum;

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

Ques. 4: Write a java program to sum of array elements.

Solution:

public class SumOfArrayElements {

public static void main(String[] args) {

int[] array = {2, 4, 6, 8, 10};

int sum = 0;

for (int i = 0; i < array.length; i++) {

sum += array[i];

System.out.println("Sum of array elements: " + sum);

Ques. 5: Write a java program to search the desired elements with its
location

Solution :

import java.util.Scanner;

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

public class ElementSearch {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

// Input the array size

System.out.print("Enter the number of elements in the array: ");

int size = scanner.nextInt();

// Input the array elements

int[] array = new int[size];

System.out.println("Enter the elements of the array:");

for (int i = 0; i < size; i++) {

array[i] = scanner.nextInt();

// Input the element to search

System.out.print("Enter the element to search: ");

int searchElement = scanner.nextInt();

// Search for the element in the array

int location = -1;

for (int i = 0; i < size; i++) {

if (array[i] == searchElement) {
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

location = i;

break;

// Print the result

if (location != -1) {

System.out.println("Element found at location: " + (location + 1));

} else {

System.out.println("Element not found in the array.");

Ques. 6: Write a java program to rearrange values in ascending order

Solution:

import java.util.Arrays;

public class RearrangeAscending {

public static void main(String[] args) {

int[] values = {5, 2, 10, 8, 1};

System.out.println("Original values: " + Arrays.toString(values));


Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

// Rearrange values in ascending order

rearrangeAscending(values);

System.out.println("Values in ascending order: " +


Arrays.toString(values));

public static void rearrangeAscending(int[] arr) {

int n = arr.length;

boolean swapped;

for (int i = 0; i < n - 1; i++) {

swapped = false;

for (int j = 0; j < n - i - 1; j++) {

if (arr[j] > arr[j + 1]) {

// Swap arr[j] and arr[j+1]

int temp = arr[j];

arr[j] = arr[j + 1];

arr[j + 1] = temp;

swapped = true;

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

// If no two elements were swapped in the inner loop, then the array is
already sorted

if (!swapped) {

break;

Ques. 7: Write a java program to find lucky number.

Solution:

import java.util.Scanner;

public class LuckyNumber {

public static int sumOfDigits(int number) {

int sum = 0;

while (number > 0) {

sum += number % 10;

number /= 10;

return sum;

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

public static int findLuckyNumber(int n) {

int count = 0;

int i = 1;

while (count < n) {

if (sumOfDigits(i) == 7) {

count++;

i++;

return i - 1;

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.print("Enter the position of lucky number: ");

int n = scanner.nextInt();

int luckyNumber = findLuckyNumber(n);

System.out.println("Lucky number at position " + n + " is " +


luckyNumber);

}
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

Ques. 8: Write a java program to check and print twin prime

Solution:

public class TwinPrimeChecker {

// Function to check if a number is prime

static boolean isPrime(int n) {

if (n <= 1) {

return false;

for (int i = 2; i * i <= n; i++) {

if (n % i == 0) {

return false;

return true;

public static void main(String[] args) {

int limit = 100; // Change this value to check for twin primes up to a
different limit

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

System.out.println("Twin Primes:");

for (int i = 2; i <= limit - 2; i++) {

if (isPrime(i) && isPrime(i + 2)) {

System.out.println("(" + i + ", " + (i + 2) + ")");

Ques. 9: Write a java program to print time in words

Solution:
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

import java.util.Scanner;

public class TimeInWords {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter the hour (0-23): ");

int hour = sc.nextInt();

System.out.print("Enter the minute (0-59): ");

int minute = sc.nextInt();

String timeInWords = getTimeInWords(hour, minute);

System.out.println(timeInWords);

sc.close();

public static String getTimeInWords(int hour, int minute) {

if (minute == 0) {

return numberToWord(hour) + " o'clock";

} else if (minute == 15) {

return "quarter past " + numberToWord(hour);

} else if (minute == 30) {

return "half past " + numberToWord(hour);

} else if (minute == 45) {

return "quarter to " + numberToWord(hour + 1);

} else if (minute < 30) {

if (minute == 1) {

return "one minute past " + numberToWord(hour);


Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

return numberToWord(minute) + " minutes past " +


numberToWord(hour);

} else {

return numberToWord(60 - minute) + " minutes to " +


numberToWord(hour + 1);

public static String numberToWord(int number) {

String[] words = {

"zero", "one", "two", "three", "four", "five", "six", "seven", "eight",


"nine",

"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",


"seventeen",

"eighteen", "nineteen", "twenty", "twenty-one", "twenty-two",


"twenty-three",

"twenty-four", "twenty-five", "twenty-six", "twenty-seven", "twenty-


eight", "twenty-nine"

};

if (number >= 0 && number <= 29) {

return words[number];

} else {

return "";

}
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

Ques.10: Write a java program to generate anagram

Solution:
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

import java.util.ArrayList;

import java.util.List;

public class AnagramGenerator {

public static void main(String[] args) {

String word = "abc";

List<String> anagrams = generateAnagrams(word);

// Print the generated anagrams

System.out.println("Anagrams of " + word + ":");

for(String anagram : anagrams) {

System.out.println(anagram);

public static List<String> generateAnagrams(String word) {

List<String> anagrams = new ArrayList<>();

generateAnagram(word.toCharArray(), 0, anagrams);

return anagrams;

private static void generateAnagram(char[] chars, int index, List<String>


anagrams) {

if (index == chars.length - 1) {

anagrams.add(String.valueOf(chars));

return;

for (int i = index; i < chars.length; i++) {

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

swap(chars, index, i);

generateAnagram(chars, index + 1, anagrams);

swap(chars, index, i); // backtrack

private static void swap(char[] chars, int i, int j) {

char temp = chars[i];

chars[i] = chars[j];

chars[j] = temp;

Ques.11: Write a java program of number sequence

Solution:
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

import java.util.Scanner;

public class NumberSequenceGenerator

public static int[] arithmeticSequence(int start, int diff, int length) {

int[] sequence = new int[length];

for (int i = 0; i < length; i++) {

sequence[i] = start + i * diff;

return sequence;

public static int[] geometricSequence(int start, int ratio, int length) {

int[] sequence = new int[length];

for (int i = 0; i < length; i++) {

sequence[i] = start * (int) Math.pow(ratio, i);

return sequence;

public static int[] fibonacciSequence(int length) {

int[] sequence = new int[length];

sequence[0] = 0;

sequence[1] = 1;

for (int i = 2; i < length; i++) {

sequence[i] = sequence[i - 1] + sequence[i - 2];

}
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

return sequence;

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.println("Number Sequence Generator");

System.out.println("1. Arithmetic Sequence");

System.out.println("2. Geometric Sequence");

System.out.println("3. Fibonacci Sequence");

System.out.print("Enter your choice (1/2/3): ");

int choice = scanner.nextInt();

if (choice == 1) {

System.out.print("Enter the starting number: ");

int start = scanner.nextInt();

System.out.print("Enter the common difference: ");

int diff = scanner.nextInt();

System.out.print("Enter the length of the sequence: ");

int length = scanner.nextInt();

int[] sequence = arithmeticSequence(start, diff, length);

System.out.println("Generated sequence:");

for (int num : sequence) {

System.out.print(num + " ");

else if (choice == 2)
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

System.out.print("Enter the starting number: ");

int start = scanner.nextInt();

System.out.print("Enter the common ratio: ");

int ratio = scanner.nextInt();

System.out.print("Enter the length of the sequence: ");

int length = scanner.nextInt();

int[] sequence = geometricSequence(start, ratio, length);

System.out.println("Generated sequence:");

for (int num : sequence) {

System.out.print(num + " ");

} else if (choice == 3) {

System.out.print("Enter the length of the sequence: ");

int length = scanner.nextInt();

int[] sequence = fibonacciSequence(length);

System.out.println("Generated sequence:");

for (int num : sequence) {

System.out.print(num + " ");

} else {

System.out.println("Invalid choice. Please select 1, 2, or 3.");

scanner.close();
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

Ques.12: Write a java program to find and print unique digit

Solution:
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

import java.util.HashSet;

public class UniqueDigitsFinder

public static void main(String[] args) {

int number = 123456789; // Example input number

HashSet<Integer> uniqueDigits = findUniqueDigits(number);

System.out.println("Unique digits in the number " + number + " are:");

for(int digit : uniqueDigits) {

System.out.println(digit);

public static HashSet<Integer> findUniqueDigits(int number)

HashSet<Integer> uniqueDigits = new HashSet<>();

while (number != 0) {

int digit = number % 10; // Extract the last digit

uniqueDigits.add(digit); // Add it to the set of unique digits

number /= 10; // Remove the last digit

return uniqueDigits;

Ques.13: write a program to check and print smith number.

Solution:
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

import java.util.ArrayList;

import java.util.List;

public class SmithNumber {

public static void main(String[] args) {

System.out.println("Smith Numbers:");

for (int i = 1; i <= 10000; i++) {

if (isSmithNumber(i)) {

System.out.print(i + " ");

public static boolean isSmithNumber(int number) {

// Find the sum of digits of the number

int digitSum = getDigitSum(number);

// Find the sum of digits of the prime factors of the number

int primeFactorSum = getPrimeFactorSum(number);

// Compare the sums

return digitSum == primeFactorSum;

public static int getDigitSum(int number) {

int sum = 0;

while (number > 0) {

sum += number % 10;

number /= 10;
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

return sum;

public static int getPrimeFactorSum(int number) {

List<Integer> primeFactors = new ArrayList<>();

// Find all prime factors of the number and store them in the list

for (int i = 2; i <= number; i++) {

while (number % i == 0) {

primeFactors.add(i);

number /= i;

// Calculate the sum of digits of prime factors

int sum = 0;

for (int factor : primeFactors) {

sum += getDigitSum(factor);

return sum;

Ques.14: Write a program of kaprekar numbers.

Solution:
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

import java.util.ArrayList;

import java.util.List;

public class KaprekarNumber {

public static void main(String[] args) {

System.out.println("Kaprekar Numbers between 1 and 10000:");

for (int i = 1; i <= 10000; i++) {

if (isKaprekarNumber(i)) {

System.out.print(i + " ");

public static boolean isKaprekarNumber(int number) {

long squared = (long) number * number;

String squaredStr = String.valueOf(squared);

for (int i = 1; i < squaredStr.length(); i++) {

String leftStr = squaredStr.substring(0, i);

String rightStr = squaredStr.substring(i);

int left = (leftStr.isEmpty()) ? 0 : Integer.parseInt(leftStr);

int right = (rightStr.isEmpty()) ? 0 : Integer.parseInt(rightStr);

if (left + right == number) {

return true;

return false;
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

Ques.15: Write a program to denomination of money.

Solution:
Name: Aarna Parashar
Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

import java.util.Scanner;

public class MoneyDenomination {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.print("Enter the amount in rupees: ");

int amount = scanner.nextInt();

int[] denominations = {2000, 500, 200, 100, 50, 20, 10, 5, 2, 1};

int[] count = new int[denominations.length];

for (int i = 0; i < denominations.length; i++) {

if (amount >= denominations[i]) {

count[i] = amount / denominations[i];

amount %= denominations[i];

System.out.println("Denominations:");

for (int i = 0; i < denominations.length; i++) {

if (count[i] > 0) {

System.out.println(denominations[i] + " Rs: " + count[i]);

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01
Sacred Heart Convent Higher Secondary SchoolProject File : Computer Applications

Name: Aarna Parashar


Class & Section: 11th – A
Class Roll Number : 01

You might also like