Combinepdf
Combinepdf
Computer Applications
Project Report
Submitted by
Grade: X
CertifiCate
Date :
TABLE OF CONTENTS
16 Palindromic String
No of
units Charge
first 100 units Rs. 1.20 per unit
Rs. 1.75 for every
next 120 units additional unit
Rs. 2.25 for every
otherwise additional unit
Calculate net bill with a meter rent of Rs. 100 is charged from each
consumer. A tax of 6% is charged on the sum of the rent and the bill amount.
The total amount is calculated by adding tax to the sum of the
amount and the rent. Display the details of the consumer.
2. If the sum of the proper divisors of a number is greater than the number
itself, then the number is called ABUNDANT OR EXCESSIVE NUMBER. If the
sum of the proper divisors of a number is less than the number itself, then
the number is called DEFICIENT OR DEFECTIVE NUMBER. If the sum of the
proper divisors of a number is equal to that number itself, then the number is
called
PERFECT NUMBER.
The proper divisors of 12 are 1, 2, 3, 4, and 6. Because the sum of its proper
divisors (1 + 2 + 3
9. Create a class called Number which contains the following class functions
(i)static int sumOfDigits(int n) which returns the sum of the digits in the
integer n
(ii) static void call() to accept two integers using Scanner object and
find the sum of the digits of each integer.
10. Write a program to get n numbers in an array and count number of odd
and even numbers in the array.
11. Write a program to store n numbers. Get a number as search element and
locate its position, if present in the list using Linear Search else display an
appropriate message
12. Write a program to search for an integer value input by the user in the
sorted list given below using binary search technique. If found display ''Search
Successful'' and print the element, otherwise display ''Search Unsuccessful''.
13.Write a program that encodes a word into Piglatin. To translate a word into a
Piglatin word, convert the word into upper case and then place the first vowel
of the original word as the start of the new word along with the remaining
alphabets. The alphabets present before the vowel
being shifted towards the end following by “YZ”.
Sample input : Flowers Sample Output: OWERSFLYZ
Sample input : Olympics Sample Output : OLYMPICSYZ
14. Write a program to initialize the seven Wonders of the World along with their
locations in two different arrays. Search for a name of the country input by the
user. If found, display the name of the country along with its Wonder,
otherwise display "Sorry Not Found
Seven wonders - CHICHEN ITZA, CHRIST THE RDEEEMER, TAJMAHAL,
GREAT WALL OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM
Locations - MEXICO, BRAZIL, INDIA, CHINA, PERU,
JORDAN, ITALY Examples: Country Name: INDIA
Output: INDIA-TAJMAHAL
Country Name: USA Output: Sorry Not Found!
15. Write a program to find the frequency of each character in a given string.
16. Write a program to input a string . Check and display message Palindrome if
the string is palindrome.
17. Write a java program to count the frequency of letters, digits, lowercase,
uppercase and whitespaces in a string. [Use Character class methods]
Public members:
• A function ENTER() to allow user to enter values for ANo, Name, Agg &
call function GradeMe() to find the Grade.
• A function RESULT() to allow user to view the content of all the data
members.
Also create a main() method to create an object and show its implementation
by calling the above methods.
19. Write a program to convert all capital letters to small letters and vice-
versa in a given string. For example,
Given He Went To The Market.
String:
Output: hE WENTwENTtOTOtHETHEmARKETMARKET..
20. Write a program to accept name and total marks of N number of
students in two single subscript array name[ ] and totalmarks[ ].
Calculate and print:
(i)The average of the total marks obtained by N
number of students. [average = (sum of total marks
of all the students)/N]
(ii) Deviation of each student’s total marks
with the average. [deviation = total marks of
a student – average]
A= Transpose of A =
22. Define a class to accept a String and print the number of digits,
alphabets and special characters in the string.
Example: S = "KAPILDEV@83"
Output: Number of digits - 2
Number of Alphabets - 8
Number of Special characters – 1
void process() {
units = present - previous; double charge;
double netBill;
void displayDetails() {
System.out.println("Month: " + month);
System.out.println("ConsumerName: " + CName);
System.out.println("CconsumerNumber: " + CNumber);
System.out.println("Net Bill: " + netBill);
}
OUTPUT:
Program 2:Abundant Number
import java.util.Scanner;
int sum = 1;
for (int i = 2; i <= Math.sqrt(num); i++) {
if (num % i == 0) {
sum += i;
if (i != num / i) {
sum += num / i;
}
}
}
}
public static void main()
{ Number obj = new Number ();
obj.process();
}
}
Variable Description:-
SN Variable Datatype Purpose
OUTPUT:
int choice;
do {
System.out.println("Menu:");
System.out.println("1. Display the sum of
series"); System.out.println("2. Print the
value of Z"); System.out.println("3. Exit");
switch (choice) {
case 1:
int y = 55;
for (int x = -10; x <= 10; x += 2)
{ double z = Math.pow(x, 3) + 0.5 * x /
y; System.out.println("For x = " + x +
", Z = " + z);} break;
case 2:
Scanner sc = new Scanner(System.in);
System.out.print("Enter the value of n: ");
int n = sc.nextInt();
int sum = 0;
int term = 1;
3 z int output
OUTPUT:
System.out.println("Tribonacci Series:");
Variable Description:-
obj.sum(5, 10);
obj.sum('A', 'B');
obj.sum(3.5f, 7.2f);
}
}
Variable Description:-
SN Variable Datatype Purpose
void calculate() {
if (cost <=
10000) { dis
= cost * 0.05;
} else if (cost <=
20000) { dis =
cost * 0.10;
} else if (cost <=
35000) { dis =
cost * 0.15;
} else {
dis = cost * 0.20;
}
customer.input();
customer.calculate();
customer.display();
}
}
Variable Description:-
// For a square
System.out.print("Enter the side of the
square: "); double sideOfSquare =
sc.nextDouble();
Shapes square = new
Shapes(sideOfSquare);
System.out.println("Square:");
square.computeArea();
// For a rectangle
System.out.print("Enter the length of the
rectangle: "); double lengthOfRectangle =
sc.nextDouble(); System.out.print("Enter the
breadth of the rectangle: "); double
breadthOfRectangle = sc.nextDouble();
Shapes rectangle = new Shapes(lengthOfRectangle, breadthOfRectangle);
System.out.println("Rectangle:");
rectangle.computeArea();
}
public static void main()
{
Shapes obj = new Shapes();
obj.process();
}
Variable Description:-
}
public static void main()
{
Number obj=new Nuimber();
obj.SumbofDigits(5)
obj.call();
}
}
Variable Description:-
1 n int input
}
public static void main()
{
ArrayOddEvenCount obj = new
ArrayOddEvenCount(); obj.process();
}
}
Variable Description:-
1 n int input
2 even int Count even
numbers
3 odd int Count odd
numbers
Program 11:Linear Search
import java.util.Scanner;
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter the number of elements
in the array: ");
int n = sc.nextInt(); lan=0;
int[]A= new int[n];
System.out.println("Enter the elements of the
array:");
for (int i = 0; i < n; i++)
{
A [i] = sc.nextInt();
}
if (position != -1) {
System.out.println("Search Successful! Element " + searchElement + " found
at position
" + (position +
1)); }
if (arr[mid] == key) {
return mid;
} else if (arr[mid] <
key) { low = mid +
1;
} else {
high = mid - 1;
}
}
Variable Description:-
class PigLatinEncoder
{
void process() {
word=word.toUpperCase();
String piglatin=" ";
int flag=0;
if(flag == 0)
{
piglatin = word + "YZ";
}
System.out.println(word + " in Piglatin format is " + piglatin);
}
public static void main()
{
PigLatinEncoder obj = new PigLatinEncoder();
obj.process();
}
}
Variable Description:-
1 x int Exception
letters
}
}
return -1;
}
public static void main()//main class
{
SevenWonderSearch obj = new SevenWonderSearch();
obj.process();
obj.searchCountryIndex(Brazil,5)
}
}
Variable Description:-
3 -_ - -
Program 15:Frequency of each Character
class Frequency { //class creation
void process() {
//initialization
String K = "Hello World";
char ch = 'e';
int frequency = 0;
//process
for(int i = 0; i < K.length(); i++) {
if(ch == K.charAt(i)) {
++frequency;
}
}
//output
System.out.println("Frequency of " + ch + " = " + frequency);
}
public static void main()
{//main class
Frequency obj = new Frequency();
obj.process();
}
}
Variable Description:-
1 K String input
2 frequency int Frequency to
be added
3 ch char Frequency to
be checked
Program 16:Palindrome of String
import java.util.Scanner;//import scanner
class Check//class creation
{//initialization
String sent;
int len;
Check( )
{
sent="";
len=0;
}
void acceptword( )
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter a word");
sent=sc.next( );
len=sent.length( );
}
boolean palindrome( )
{
for(int i=0, j=len-1; i<=j; i++, j--)
{
if(wrd.charAt(i)!=sent.charAt(j))
return false;
}
return true;
}
public void display( )
{
System.out.print(wrd);
if(palindrome( ))
System.out.println("is a Palindrome word");
else
System.out.println("is not a Palindrome word");
}
public static void main(String ar[ ])//main class
{
Check obj=new Check( )
obj.acceptword( );
obj.display( );
}
}
Variable Description:-
Variable Description:-
scanner.nextLine();
System.out.print("Enter Name: ");
Name = scanner.nextLine();
GradeMe();
}
Variable Description:-
3 - -- ---
Program 20:Array-Marks
import java.util.Scanner;
class StudentMarks {
void process() {
Scanner scanner = new Scanner(System.in);
/ Calculate average of
total marks double sum =
0;
for (double marks :
totalMarks) { sum +=
marks;
}
double average = sum / N;
}
public static void main()
{
StudentMarks obj = new StudentMarks();
obj.process();
}
}
Variable Description:-
SN Variable Datatype Purpose
System.out.println("\nOriginal Matrix:");
printMatrix(matrix);
scanner.close();
}
return transposeMatrix;
}
class SelectionSort {
void process() {
Scanner scanner = new
Scanner(System.in);
Variable Description:-
3 temp int
Program 23:3x3 Array
import java.util.Scanner;
class ArrayOperations {
void process() {
Scanner scanner = new Scanner(System.in);
int diagonalSum = 0;
}
public static void main()
{
IntegerArrayOperations obj = new
IntegerArrayOperations(); obj.process();
}
}
Variable Description:-
Variable Description:-
1 j int looping
2 i int looping