Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

SUBMITTED TO : MRS.

MEENAKSHI NEGI
SUBMITTED BY: PARTH SHARMA
X-A
R.NO-26
ACKNOWLEDGEMENT
I have taken much efforts in this
project, however it would not have
been possible without the kind support
and help of many individuals. I would
like to extend my sincere thanks to all
of them.

I am highly indebted to “Mrs.


Meenakshi Negi” for her guidance and
constant supervision as well as for
providing necessary information
regarding this project and also for her
support in completing this project.

I would like to express my gratitude to


my parents and friends for their
cooperation and encouragement which
helped me in completion of this project.
I would also like to thank the well
wishers who always thought well of
me.

PAGE 1
INDEX
S.NO CONTENT PAGE NO.

1 INTRODUCTION 1
2 IT ICON-JAMES GOSLING 2
3 SECTION A- DEFINITION 3
4 SECTION B- DIFFERENCES 4,5
5 SECTION C- PROGRAMS 6-12
6 CONCLUSION 13
7 BIBLIOGRAPHY 14

PAGE 2
INTRODUCTION
A computer is a multipurpose electronic device
that can recieve, process and store data. They
are used as tools in every part of society
together with the internet. Computers
nowadays are complex; there are lot of different
components inside them, and they all serve
different purposes. They all need to work
together for the computer to work; knowing how
a computer works makes it easier to use a
computer by being able to understand how a
computer will respond.

Nowadays computer is very necessary and in


every sector it is needed. All major works are
supported by this device.

It is a major step towards progress and


development of oneself.

PAGE 3
IT ICON -:
JAMES GOSLING
James Arthur Gosling is a Canadian computer
scientist, best known as the founder and lead
designer behind the Java programming language.
James Gosling was born on 19 May, 1955 in Alberta,
Canada.

Gosling was with Sun Microsystems between 1984


and 2010. He is known as the “Father of the
Javaprograming language”. He got the idea of
Java VM while writing a program to port software
from PERQ by translating Perq Q-Code to VAX
assembler. He left Sun Microsystems on April 2, 2010
after it was acquired by Oracle Corporation, citing
reductions in pay, status, and decision-making ability,
along with change of role and ethical challenges. In
march 2011, Gosling left Oracle to work at Google. Six
months later, he followed his colleague Bill Vass and
joined a startup called Liquid Robotics. Gosling left
Liquid Robotics to work at Amazon Web Services as a
Distinguished Engineer in May 2017.

He is an advisor at Scala company Typesafe Inc,


Independent Director at Jelastic, and Strategic

PAGE 4
Advisor for Eucalptus, and is a board member of
DIRTT Environmental Solutions.

He is known for his love of proving “the unknown”


and has noted that his favorite irrational number is
√2. He has a framed picture of the first 1,000 digits of
√2 in his office.

PAGE 5
SECTION-A
DEFINITION -:
1-: CLASS-: Class is a blue print or a prototype that
is used to define variables and methods
common to all objects of a certain kind.

2-: OBJECT-: Object is a software bundle of


variables and related methods.

3-: MESSAGE-: Software objects communicate and


interact with each other using messages.

4-: ABSTRACTION-: Abstraction is the representation


of essential features of a system without getting
involved the complexity of entire system.

5-: FUNCTION-: Function is a subprogram within a


main program, which processes data and
returns value.

6-: CONSYRUCTOR-: Constructor is a specialized


method of a class which has the same name as of
the class name and automatically gets invoked
whenever an object of the class is created and is
used to initialize the data members.

7-: PACKAGE-: A package is a collection of related


classes, providing access protection and
namespace management.

8-: ARRAY-: An array can be defined as set of


homogenous data elements (similar name and
similar data type) stored in a contiguous
memory location

PAGE 6
SECTION – B
DIFFERNCES-:
1-: WHILE LOOP DO WHILE LOOP
1-It is entry control loop. 1- It is exit control loop
2- Condition is checked at the beginning of 2- It is checked in the end of the
a loop. loop.
3 - If the condition is false the loop will not be 3- If the condition is false loop will be
executed even once. executed once.
4- It is never terminated with semi-colon. 4- It is terminated with semi-colon.

2-: FORMAL PARAMETERS ACTUAL


PARAMETERS
1-The parameters of the method when the 1-The parameters of the method
when
method is called. the method is actually defined.

2-They are not preceded by datatype. 2-They are preceded by datatype.

3-: CONSTRUCTOR FUNCTION


1-It has the same name as the class name. 1-It does not have the same name as
class name.
2-It has no return type. 2-It may have return type.
3-It gets invoked when object is created. 3-It gets invoked when object calls
the method using dot operator.
4-It is used to initialize instance variables. 4-It is used to perform a specific task.
5-The access should always be public. 5-The access can be public, private
or
protected.

PAGE 7
4-: PREFIX POSTFIX
1-Operator is placed before operand. 1-Operator is placed after
operand.

5-: IMPLICIT CONVERTION EXPLICIT


CONVERTION
1- Conversion of one primitive data type 1- Conversion of one primitive data
to another. type to another using type
casting
operator.
2- In this two types are compatible. 2- Inthis two types are
incompatible.

6-: LINEAR SEARCH BINARY SEARCH


1-The array elements need not be in a sorted 1-The array element should be in a
format. sorted format.
2-Searching process becomes slow when 2-Binary search is fast.
records are many.
3-It checks for each element in the array. 3-In this process most of elements
are
skipped during the searching
process.

7-: CALL BY VALUE CALL BY


REFERENCE
1-In call by value the formal parameter 1-In call by reference formal
parameter
receives copies of data from the actual just refers to the actual parameter i.e.

PAGE 8
parameter. the memory location of actual
parameter.
2-Changes made to the formal parameter 2-Changes made to the formal
parameter
do not affect the actual parameter. effects the state of actual parameter.
3-The actual parameters in the function 3-The actual parameters for the
function
the data type is of primitive type. i.e. the objects of given class type are
passed as parameters.

PAGE 9
SECTION-C
PROGRAMS-:
1-Finding the occurrence of selective text with in a string.
SOLUTION-:
class Subtext
{
public static void main(String str, String sub)
{
int x = str.length();
int y = sub.length();
int count = 0;
String temp;
for(int i=y; i<=x; i++)
{
temp = str.substring(i-y,i);
System.out.println(temp);
if(temp.equals(sub))
{
count++;
}
}
System.out.println(count);
}
}

PAGE 10
2-Program to reverse each word in a string.
SOLUTION-:
class Reveach

static void revword1(String str)

int p = 0;

int l = str.length();

for(int i=0;i<l;i++)

int x = (int)str.charAt(i);

if(x==32 || i==l-1)

{ for(int j=i;j>=p;j--)

{System.out.println(str.charAt(j));

p = i;

PAGE 11
3-Program to display whether the given string is a palindrome.
SOLUTION-:
class Pro1

static void check_palin(String str)

int x = str.length();

String rev = "";

for(int i=(x-1);i>=0;i--)

rev = rev + str.charAt(i);

if( rev.equalsIgnoreCase(str))

System.out.println("The string is a palindrome");

else

System.out.println("The string is not a palindrome");

PAGE 12
4-Write a program of binary search.
SOLUTION-:
class Bsearch
{ static void binarysearch(int a[], int val)
{
int lb = 0;
int ub = a.length -1;
int pos = -1;
int mid;
while(pos == -1 && (ub>=lb))
{ mid = (ub+lb)/2;
if (a[mid]==val)
{
pos = mid;
}
if(a[mid]<val)
{
lb = mid+1;
}
else
{
ub = mid+1;
}
}
if(pos == -1)
System.out.println("Element is not present in the list");
else
System.out.println("Element is at position no."+(pos+1));
}

PAGE 13
}

PAGE 14
5-Write a program to find all prime numbers between 1 to 100.
SOLUTION-:
class Prime
{
static booleanprime(int num)
{
int c = 0;
for(int i=1;i<=num;i++)
{
if(num%i ==0)
{
c++;
}
}
if(c == 2)
return true;
else
return false; //function returning boolean
value
}
public static void main()
{
for(int i=0;i<=100;i++)
{
if(prime(i)) //calling subfunction prime() 100
times
{
System.out.println(i); //if i is prime it will print

PAGE 15
}
}
}
}

PAGE 16
6-1! + 2! + 3! +………n!
SOLUTION-:
class P28

static int fact(int x) //fact() method returns factorial for


given number

int p = 1;

for(int i=1;i<=x;i++)

p = p*i;

return p;

static void series(int n)

int sum = 0;

for(int i=1;i<= n;i++) //subfunction is called n number of


times

sum = sum + fact(i);

System.out.println("1!+2!+3!+.....n! = " +sum);

}
PAGE 17
PAGE 18
7-1 + 2/2! + 3/3! + 4/4!......+ n/n!
SOLUTION-:
class P29
{
static int fact(int x) //fact method returns factorial for
given number
{
int p = 1;
for(int i=1;i<=x;i++)
{
p = p*i;
}
return p;
}
static void series(int n)
{
double sum = 0;
for(int i=1;i<=n;i++)
{
sum = sum + (double)(i/fact(i));
}
System.out.println("1+2/2!+3/3!+4/4!......+n/n ="+ sum);
}
}

PAGE 19
CONCLUSION
I felt very interesting in doing this project. It
gave a lot of knowledge while completing
this project.
I came to know about the great IT ICON
“JAMES GOSLING” whose works are very
much inspiring and full of knowledge like
“java”. I understood how to make programs
in java. The definitions and differences will
help me in my exams. By learning them I
can understand the lessons better.
So thankyou mam for giving me this project
which made my summer vacations
interesting and full of fun.

PAGE 20
BIBLIOGRAPHY
SITES-: www.wikipedia.com
www.google.com

BOOKS AUTHORS
TOTAL COMPUTER RAVI KHURANA
APPLICATIONS. P.S. LATIKA

PAGE 21

You might also like