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

Computer Project: Mrs - Meenakshi Negi Harshit Dhiman

This document contains an acknowledgement page thanking those who helped with a school computer project, an index listing the topics covered in the project, and an introductory page about James Gosling, the creator of the Java programming language. It provides high-level overviews of key computer science concepts like definitions, access specifiers, the Scanner class, and library functions. The project appears to be focused on teaching computer science topics through examples and programs.

Uploaded by

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

Computer Project: Mrs - Meenakshi Negi Harshit Dhiman

This document contains an acknowledgement page thanking those who helped with a school computer project, an index listing the topics covered in the project, and an introductory page about James Gosling, the creator of the Java programming language. It provides high-level overviews of key computer science concepts like definitions, access specifiers, the Scanner class, and library functions. The project appears to be focused on teaching computer science topics through examples and programs.

Uploaded by

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

Page |0

Computer
Project

Submitted to: Mrs.Meenakshi Negi


Submitted by: harshit dhiman
Standard: X C
Roll No.13
Page |1

Acknowledgement
I place my gratitude to all those who helped me in completion of this
project. I am very grateful to our school Principal Sister Anila
Bastine and my teacher Mrs.Meenakshi Negi for providing me with
this project. It was a golden opportunity for me to make this project
and I learnt a lot about it.

I am also thankful to her for her valuable suggestions and constant


guidance at various stages of preparing this project. Without her
support and help, I would have never had been able to complete this
project.

My special thanks to my parents and my siblings who helped me a lot


in collecting information. This project has gratefully increased my
knowledge about many topics in computer subject . I am also thankful
to my friends for constantly and enthusiastically supporting me
throughout the working of this project.
Page |2

Index
S.no. Topic Pg.no.

1. I.T. icon(James Gosling) 3

2. Introduction of Blue-J 4

3. Section-A
 Definitions 5
 Access Specifier 6
 Scanner Class(10 methods of scanner class) 7,8
 Library Functions(10 String Library Functions, 9,10
10 Math Functions)

4. Section-B
 Programs

(a) Program to sort given elements. 11,12


(b) Program to display capital of given state. 12,13
(c) Program to input a string and count the 13,14
number of vowels.
(d) Program to accept data from the user on 2-D 14,15
array.
(e) Program to store SCHOOL in Variable V and 15,16
display in ascending and descending triangles.

5. Conclusion 17

6. Bibliography 18
Page |3

I.T. icon
James Gosling: The brilliant techie was born on 19th May in the
summer of 1955. The land which was blessed with the birth of such a
wonderful man is Calgary in the state of Alberta, Canada. James since
his childhood had a lot of interest in the newly developing computer
technology at that time. So he did Bachelor of Science from the very
famous University of Calgary, Canada, with province in Computer
Science in the year of 1977. Later in 1983 he went forward towards
doing his PHD in Computer Science from the Carnegie Mellon
University. At the time of PHD his doctoral thesis was entitled as,
"Algebraic Manipulation of Constraints". At the time of his studies he
was also dedicated towards writing of Emacs, which he names as the
Gomacs, he also worked towards development of multiprocessor
version of the operating system UNIX, and several compilers as well
as mail systems.

In the year of 1984 Sun Microsystems hired this great man. Gosling
worked with Sun Microsystems for an immense period of 26 years,
and left after it was acquired by the Oracle. Later in 2011 he joined to
work with Google. He worked there for some time and later he joined
his old Sun colleague in a startup names "Liquid Robotics". After a
few years Liquid Robotics was acquired by Boeing. After this
happened gosling left it and later started working with Amazon since
May, 2017.

Before development of the java language world relies on C++, which


incorporated several oops concepts and looked perfect at that time.
But then it was realized that C++ can be made to program only a
specific set of devices, as it is platform dependent. This led James
towards the motivation of creating a platform independent language
which apart from computer could be used to program other devices as
well. James with some of his colleagues started working towards the
development of this language in the year 1991.
Page |4

Introduction of Blue-J
The development of Blue-J was started in 1999 by Michael
Kolling and John Rosenberg at Monash University, as a successor
to the Blue systems. Blue-J is an IDE (Integrated Development
Environment). Blue was an integrated system with its own
programming language and environment, and was a relative of
the Eiffel language. Blue-J implements the Blue environment design
for the Java programming language.

Blue-J is an integrated development environment (IDE) for


the Java programming language, developed mainly for educational
purposes, but also suitable for small-scale software development.

Blue-J was developed to support the learning and teaching of object


oriented-programming, and its design differs from other
development environments as a result. The main screen graphically
shows the class structure of an application under development (in
a UML-like diagram), and objects can be interactively created and
tested. This interaction facility, combined with a clean, simple user
interface, allows easy experimentation with objects under
development.
Blue-J has a simpler interface than most professional IDEs, but its
functionality is not a subset of those kinds of environment. While
many of the standard development tools exist, such as an editor,
compiler and runtime environment, it also offers tools that are specific
to its educational goals and not found in this form in common
professional environments.
Page |5

Section –A

Definitions

 Array: An array can be defined as set of homogenous data


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

 Constructor: A constructor is a special class in which class name


and method name is same.

 Encapsulation: Encapsulation in Java is a mechanism of wrapping


the data (variables) and code acting on the data (methods) together
as a single unit. In encapsulation, the variables of a class will be
hidden from other classes, and can be accessed only through the
methods of their current class. Therefore, it is also known as data
hiding.

 Wrapper Class: A Wrapper class is a class whose object wraps or


contains a primitive data types. When we create an object to a
wrapper class, it contains a field and in this field, we can store a
primitive data types. In other words, we can wrap a primitive value
into a wrapper class object.
Page |6

Access specifier
An important aspect of encapsulation is the control of information or
data sharing which is provided through access specifiers. They are
like entry gates that control what information or data can be
accessible to whom. Access Specifiers specify or restrict thee access
of a class, constructor, data members, methods and variables. Take
the example of your house which has bedroom, drawing room, study
room. Now you can specify who has access the different rooms. For
example your best friend can access your drawing room and study
room, your other friends can access your drawing room but only you
can access your bedroom. Access specifiers works in same fashion.
Page |7

Scanner class
Scanner class in Java is found in the java.util package. Java provides
various ways to read input from the keyboard; the java.util.Scanner
class is one of them.

The Java Scanner class breaks the input into tokens using a delimiter
which is whitespace by default. It provides many methods to read and
parse various primitive values.

The Java Scanner class is widely used to parse text for strings and
primitive types using a regular expression. It is the simplest way to
get input in Java. By the help of Scanner in Java, we can get input
from the user in primitive types such as int, long, double, byte, float,
short, etc.

The Java Scanner class extends Object class and implements iterator
and Closeable interfaces.

10 methods of scanner class are:


close(): It is used to close the scanner.
delimiter(): It is used to get the Pattern which the Scanner class
is currently using to match delimiters.
findAll(): It is used to find a stream of match results that match
the provided pattern string.
findInLine(): It is used to find the next occurrence of a pattern
constructed from the specified string, ignoring delimiters.
hasNext(): It returns true if this Scanner has another token in its
input.
hasNextLong(): It is used to check if the next token in this
Scanner’s input can be interpreted as a Long using the nextLong()
method or not.
Page |8

hasNextLong(): It is used to check if the next token in this


Scanner’ input can be interpreted as a Long using the nextLong()
method or not.
locale(): It is used to get a Locale of a Scanner class.
next(): It is used to get the next complete token from the scanner
which is in use.
nextBigDecimal(): It scans the next token of the input as a
BigDecimal.
Page |9

Library functions
Library functions are the inbuilt functions present in Java
library classes, provided by Java system to help programmers to
perform their task in an easier way.

10 String library functions are:


toLowerCase(): It is used to convert all characters of a string to
lower case.

toUpperCase(): It is used to convert all characters of a given


string to upper case.

startsWith(): It is used to check whether a given string starts


with a particular string given in the parenthesis.

endsWith(): It is used to check whether a given string ends with


a particular string given in the parenthesis.

replace(): It is used to replace the appearance of the first


character with the another character.

indexOf(): It is used to display of a given character from left.


lastIndexOf(): It is used to give the last appearance of a
character from right.

compareTo(): It is used to compare two strings and returns the


value

equals(): It is used to check whether both the strings are equal or


not.

substring(): It is used to extract a character from a given string.


P a g e | 10

10 Math functions:
Math.sqrt(): It is used to give square root of a given number.
Math.pow(): It is used to find the value of power of a given
number.

Math.max(): It is used to find the maximum number.


Math.min(): It is used to find the maximum number.

Math.ceil(): It returns the double value that is greater than or


equal to the argument and is equal to the
nearest mathematical integer.

Math.floor(): It returns the largest (closest to positive


infinity) double value that is less than or equal to the argument
and is equal to a mathematical integer.

Math.round(): It returns always a nearest rounded


integer/long value of a number.

Math.abs(): It returns the absolute value of an int value.


Math.rint(): It is used to round the argument to nearest
mathematical integer.

 Math.random(): It is used to return a pseudorandom double


type number greater than or equal to 0.0 and less than 1.0.
P a g e | 11

Section –B

Programs
Ques 1: Write a program to sort the given elements
int marks[] = {67,76,55,89,78}
Ans1: public class BubbleSort
{
public static void main(String args[]){
int marks[]={67,76,55,89,78};
int len = marks.length;
for (int i = 0; i< len-1; i++){
for (int j = 0; j< len-i-1; j++){
if (marks[j] > marks[j+1])
{
// swap temp and arr[i]
int temp = marks[j];
marks[j] = marks[j+1];
marks[j+1] = temp;
}
}
P a g e | 12

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


{
System.out.println(marks[i]);
}
}
}

Ques 2: Write a program which displays capital of a given state.


Ans 2: import java.io.*;
class Find
{ static void search() throws IOException
{ BufferedReader obj = new BufferedReader(new
InputStreamreader(System.in));
String state[] = {“Maharashtra”,”Karnataka”,”Gujarat”};
String city[] = {“Mumbai”,”Banglore”,”Gandhinagar”};
int x = state.length;
int pos = 0;
System.out.println(“Enter the name of the state :\t”);
String val = obj.readLine():
for(int i=0;i<0;i<x;i++)
{ if(state[i].equalsIgnoreCase(val))
{ System.out.println(“The capital of state “+ state[i] + “is
:”+city[i]);
pos = i + 1;
break;
P a g e | 13

}
}
if(pos==0)
{ System.out.println(“Record not found”);
}
}
}

Ques 3: Write a program to input a string and count the number of


vowels.
Ans 3: class vowel
{
void Disp(String str)
{
String str1 = str.toLowerCase();
int count = 0;
for(int i = 0;i<str.length();i++)
{
char t = str.charAt(i);
if(t==’a’//t==’e’//t==’i’//t==’o’//t==’u’)
{
count++ ;
}
System.out.println(“Number of Vowels are” + count);
}
P a g e | 14

}
}

Ques 4: Write a program to accept data from user in 2-D array


Ans 4: import java.util.Scanner;
public class TwoDimen
{
public static void main (String args[]){

Scanner s = new Scanner(System.in);


System.out.println(“Enter the number of row”);
int row = s.nextInt();
System.out.printn(“Enter the number of column”)
int column = s.nextInt();
int mat[][] = new int [row][column];

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


for(int j = 0; j<column; j++){
System.out.println(“Enter the value”);
math[i][j] = s.nextInt();
}
}
for(int i = 0; i<row ; i++){
for(int j = 0; j<column; j++){
System.out.println(mat[i] [j]+”\t”);
P a g e | 15

}
System.out.println();
}
}
}

Ques 5: Write a program to store SCHOOL in variable V and display


in (a) ascending and (b) descending triangle.
Ans 5(a): class P1
{
void Disp()
{
String V = “SCHOOL”;
for(int i = 0; i<=V.length();i++)
{
System.out.print(V.substring(0,i);
}
System.out.println();
}
}

Ans 5(b): class P2


{
void Disp()
{
P a g e | 16

String V = “SCHOOL”;
for(int i = 0; i>6; i--)
{
System.out.print(V.substring(0,i);
}
Syatem.out.println();
}
}
P a g e | 17

Conclusion
I am very happy to make this project. I would like to end this project
by concluding that Java language has wonderfully connected
computers to the real world. The whole new concept of object, having
its attributes and behaviour have taken computer language and coding
to a completely new level.
While doing this project, I learnt a lot about James Gosling, The
Father of Java. The ease which Java has created to study and interact
with immense and unrealistic for a new comer. I learnt how a segment
of a program can put hours of work to work of few minutes.
I tried to gather and sum up as many point as possible in the project.
It contains the basic details of the journey of Gosling and the path of
Sun Microsystems through which Java was made. It also included
some basic definitions for easy understanding of basic terms in Java
language. I ended the project with samples of programs.
To sum up, this whole project was of great interest for me and has
filled my mind with knowledge and curiosity to know more about this
language.
I also want to thank my Teacher for providing me with this project
and my friends and relatives who helped me so that I can complete
this project in limited time phrase.
P a g e | 18

Bibliography
Browser/Book Sites/Author

Google Chrome Wikipedia. in, javatpoint.com,


java.com,Brainly.com,
oracle.com/java

Total Computer P.S. Latika, Aman Singh, Shiv


Applications(Class10) Pratap Singh

You might also like