-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving java program and class files to remote repo.
- Loading branch information
1 parent
57f2a7c
commit 28454eb
Showing
2,199 changed files
with
72,023 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//accepting integer value: | ||
|
||
import java.io.*; | ||
|
||
public class AccepInteger | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
|
||
int num; | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter an integer value:"); | ||
num=Integer.parseInt(br.readLine()); | ||
|
||
System.out.println("integer="+num); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//accept boolean value: | ||
|
||
import java.io.*; | ||
|
||
public class AcceptBoolean | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
boolean value; | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter a boolean value:"); | ||
value=Boolean.parseBoolean(br.readLine()); | ||
|
||
System.out.println("boolean value="+value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//accepting a character: | ||
import java.io.*; | ||
public class AcceptChar | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter a character:"); | ||
char ch=(char)br.read(); | ||
|
||
System.out.println("character:"+ch); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//accepting double value: | ||
|
||
import java.io.*; | ||
public class AcceptDouble | ||
{ | ||
public static void main(String []args) throws IOException | ||
{ | ||
double dist; | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter double value:"); | ||
dist=Double.parseDouble(br.readLine()); | ||
|
||
System.out.println("Double valu="+dist); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//accepting float value: | ||
|
||
import java.io.*; | ||
public class AcceptFloat | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
float pi; | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter float value:"); | ||
pi=Float.parseFloat(br.readLine()); | ||
|
||
System.out.println("float value="+pi); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//accepting loong value: | ||
import java.io.*; | ||
public class AcceptLong | ||
{ | ||
|
||
public static void main(String args[]) throws IOException | ||
{ | ||
long measure; | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter long value:"); | ||
measure=Long.parseLong(br.readLine()); | ||
|
||
System.out.println("long value:"+measure); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//accepting Short value: | ||
import java.io.*; | ||
public class AcceptShort | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
short age; | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter short value:"); | ||
age=Short.parseShort(br.readLine()); | ||
|
||
System.out.println("short value="+age); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//acceepting string : | ||
|
||
import java.io.*; | ||
|
||
public class AcceptString | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter a string:"); | ||
String str=br.readLine(); | ||
|
||
System.out.println("string is:"+str); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//accepting and displaying values of different datatypes: | ||
import java.io.*; | ||
public class AcceptValues | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
String name; | ||
int roll; | ||
float perc; | ||
char gender; | ||
|
||
System.out.println("enter name:"); | ||
name=br.readLine(); //accept string | ||
System.out.println("enter roll.no:"); | ||
roll=Integer.parseInt(br.readLine()); //accept integer | ||
System.out.println("enter percentage:"); | ||
perc=Float.parseFloat(br.readLine()); //accept float | ||
System.out.println("enter gender:"); | ||
gender=(char)br.read(); //accept character | ||
|
||
System.out.println("name="+name); | ||
System.out.println("roll.no="+roll); | ||
System.out.println("percentage:"+perc); | ||
System.out.println("gender="+gender); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import java.io.*; | ||
import java.util.*; | ||
public class AcceptingData { | ||
|
||
public static void main(String args[]) throws IOException | ||
{ | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
System.out.println("enter name,age,gender:"); | ||
String str=br.readLine(); | ||
|
||
StringTokenizer st=new StringTokenizer(str,","); | ||
|
||
String s1=st.nextToken(); | ||
String s2=st.nextToken(); | ||
String s3=st.nextToken(); | ||
|
||
s1=s1.trim(); | ||
s2=s2.trim(); | ||
s3=s3.trim(); | ||
|
||
String name=s1; | ||
int age= Integer.parseInt(s2); | ||
String gender=s3; | ||
|
||
System.out.println("name="+name); | ||
System.out.println("age="+age); | ||
System.out.println("gender="+gender); | ||
|
||
} | ||
|
||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package Arithmetic; | ||
|
||
public class Division | ||
{ | ||
private double num1, num2; | ||
|
||
public Division(double a, double b) | ||
{ | ||
num1 = a; | ||
num2 = b; | ||
} | ||
|
||
public void div() | ||
{ | ||
System.out.println(num1/num2); | ||
} | ||
|
||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package Arithmetic; | ||
|
||
public class Multiplication | ||
{ | ||
private double num1, num2; | ||
|
||
public Multiplication(double a, double b) | ||
{ | ||
num1 = a; | ||
num2 = b; | ||
} | ||
|
||
public void mul() | ||
{ | ||
System.out.println(num1*num2); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package Arithmetic; | ||
|
||
public class Subtraction | ||
{ | ||
private double num1, num2; | ||
|
||
public Subtraction(double a, double b) | ||
{ | ||
num1=a; | ||
num2=b; | ||
} | ||
|
||
public void sub() | ||
{ | ||
System.out.println(num1-num2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package Arithmetic; | ||
public class Addition | ||
{ | ||
/** this class is used for addition of any tw numbers */ | ||
private double num1, num2; | ||
|
||
public Addition(double a, double b) //constructor | ||
{ | ||
/** Addition is a constructor to initialise values */ | ||
num1 = a; | ||
num2 = b; | ||
} | ||
|
||
public void sum() | ||
{ | ||
/** this void sum() method shows the output of sum */ | ||
System.out.println(num1+num2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//3D Array : | ||
import java.lang.*; | ||
public class Array3D | ||
{ | ||
public static void main(String args[]) | ||
{ | ||
int arr[][][]={ { {10,20,30}, {40,50,60}}, | ||
{ {70,80,90}, {20,40,60}}, | ||
{ {10,30,50,},{90,70,20} } }; | ||
|
||
for(int i=0;i<3;i++) //tables | ||
{ | ||
System.out.println("table:"+i); | ||
for(int j=0;j<2;j++) //rows | ||
{ | ||
//System.out.print("row:"+j); | ||
for(int k=0;k<3;k++) //columns | ||
{ | ||
System.out.print(arr[i][j][k]+" "); | ||
} | ||
System.out.println(); | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//to find the length of an array: | ||
|
||
import java.io.*; | ||
//import java.util.Scanner; | ||
public class ArrayLength | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
//Scanner key=new Scanner(System.in); | ||
//int n=key.nextInt(); | ||
System.out.println("enter size of array:"); | ||
int n=Integer.parseInt(br.readLine()); | ||
int arr[]=new int[n]; | ||
System.out.println("enter array elements:"); | ||
for(int i=0;i<n;i++) | ||
{ | ||
arr[i]=Integer.parseInt(br.readLine()); | ||
} | ||
int length=arr.length; // "arrayname.length" is syntax to find length of an array. | ||
System.out.println("length of array="+length); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import java.io.*; | ||
public class BubbleSort | ||
{ | ||
public static void main(String args[]) throws IOException | ||
{ | ||
InputStreamReader obj=new InputStreamReader(System.in); | ||
BufferedReader br=new BufferedReader(obj); | ||
|
||
int n,temp; | ||
System.out.println("enter size:"); | ||
n=Integer.parseInt(br.readLine()); | ||
int arr[]=new int[n]; | ||
System.out.println("enter array elements:"); | ||
for(int t=0;t<n;t++) | ||
{ | ||
arr[t]=Integer.parseInt(br.readLine()); | ||
} | ||
for(int i=0;i<=n-2;i++) | ||
{ | ||
for(int j=0;j<=n-2-i;j++) | ||
{ | ||
if(arr[j]>arr[j+1]) | ||
{ | ||
temp=arr[j]; | ||
arr[j]=arr[j+1]; | ||
arr[j+1]=temp; | ||
} | ||
} | ||
} | ||
System.out.println("list after bubble sorting:"); | ||
for(int k=0;k<n;k++) | ||
{ | ||
System.out.println(arr[k]); | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.