Skip to content

Commit 93721b7

Browse files
committed
Add Code | Other Previous Code
1 parent f478844 commit 93721b7

17 files changed

+400
-0
lines changed

All_if_else.class

1.22 KB
Binary file not shown.

All_if_else.java

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
// import java.util.Scanner;
2+
//
3+
// public class All_if_else{
4+
// public static void main(String args[]){
5+
6+
// int cp,sp;
7+
// Scanner obj=new Scanner(System.in);
8+
9+
// System.out.println("\n\nEnter the Cost Price");
10+
// cp=obj.nextInt();
11+
12+
// System.out.println("\nEnter the Selling Price");
13+
// sp=obj.nextInt();
14+
15+
// if(cp>sp)
16+
// System.out.println("Your are In Lose "+(cp-sp));
17+
// else if(sp>cp)
18+
// System.out.println("You are In Profit "+(sp-cp));
19+
// else
20+
// System.out.println("No loss No profile");
21+
// }
22+
// }
23+
24+
25+
26+
27+
28+
// import java.util.Scanner;
29+
30+
// public class All_if_else{
31+
// public static void main(String args[]){
32+
33+
// Scanner obj=new Scanner(System.in);
34+
// int Number;
35+
// System.out.println("\n\nEnter The Number to Check Even or Odd");
36+
// Number=obj.nextInt();
37+
// if(Number%2==0)
38+
// System.out.println("Number Is Even");
39+
// else
40+
// System.out.println("Number Is Odd");
41+
// }
42+
// }
43+
44+
45+
// import java.util.Scanner;
46+
// public class All_if_else{ //Class Name
47+
// public static void main(String args[]){
48+
// // int year;
49+
// Scanner obj=new Scanner(System.in);//Scanner class for taking input
50+
// System.out.println("\n Enter The year to check its leap year or not");
51+
// int year=obj.nextInt(); // taking input
52+
// if((year%400==0)||(year%4==0)) //apply OR condition to check
53+
// System.out.println(year+" its is a leap Year");
54+
// else
55+
// System.out.println(year+" its not a leap year");
56+
57+
// }
58+
// }
59+
60+
61+
62+
// import java.util.Scanner;
63+
// public class All_if_else{
64+
// public static void main(String args[]){
65+
// int reverse=0,number,original_number;
66+
// Scanner obj=new Scanner(System.in);
67+
// System.out.println("\n Enter the number to check its reverse number is equal or not ");
68+
// number=obj.nextInt();
69+
// original_number=number;
70+
// while(number!=0)
71+
// {
72+
// reverse=reverse * 10;
73+
// reverse=reverse + number % 10 ;
74+
// number=number / 10;
75+
// }
76+
// if(original_number == reverse)
77+
// System.out.println(reverse+" Reverse number is Equal to "+original_number+" Original Number\n");
78+
// else
79+
// System.out.println(reverse+" Reverse Number is not Equal to "+original_number+" Original number\n");
80+
// double k=20.0,y=09.0;
81+
// float d=k/y;
82+
// System.out.println(d);
83+
// }
84+
// }
85+
86+
87+
88+
89+
90+
91+
92+
93+
import java.io.*;
94+
import java.math.*;
95+
import java.security.*;
96+
import java.text.*;
97+
import java.util.*;
98+
import java.util.concurrent.*;
99+
import java.util.regex.*;
100+
101+
public class All_if_else {
102+
103+
104+
105+
// private static final Scanner scanner = new Scanner(System.in);
106+
107+
// public static void main(String[] args) {
108+
// int N = scanner.nextInt();
109+
// if(N%2==0){
110+
111+
// if((N<2)&&( N>5)){
112+
// System.out.println("Not Weird");
113+
// }
114+
// else if((N<6)&&(N>20)){
115+
// System.out.println("Weird");
116+
// }
117+
// else if(N>20)
118+
// { System.out.println("Not Weird");
119+
// }
120+
// }
121+
// else{
122+
123+
// System.out.println("Weird");
124+
// }
125+
// String s= scanner.nextLine();
126+
// scanner.close();
127+
public static void main(String[] args) {
128+
Scanner scan = new Scanner(System.in);
129+
int i = scan.nextInt();
130+
131+
double d = scan.nextDouble();
132+
String s = scan.nextInt();
133+
134+
// Write your code here.
135+
136+
System.out.println("String: " + s);
137+
System.out.println("Double: " + d);
138+
System.out.println("Int: " + i);
139+
}
140+
}
141+
142+
143+
144+
145+
146+
147+
148+
149+
150+
151+
152+
153+
154+
155+
156+
157+
158+
159+
160+
161+
162+
163+
164+
165+
166+
167+
168+
169+
170+
171+
172+
173+
174+
175+

JDBCDemo.java

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import javax.swing.*;
2+
import java.awt.*;
3+
import java.awt.event.*;
4+
5+
class Demo1 implements ActionListener
6+
{
7+
JFrame frame =new JFrame("JDBC Demo");
8+
Container con= frame.getContentPane();
9+
JLabel lmainhead,lname,lemail,lmobile,lgender,ldob,lpassword,lregis,lsearch,ldelete;
10+
JTextField tname,temail,tmobile,tsearch,tdelete;
11+
JPasswordField pass;
12+
JRadioButton r1,r2;
13+
ButtonGroup day, month,year;
14+
JCheckBox term;
15+
JButton submit,reset,showall,search,delete;
16+
JTextArea display;
17+
Demo1()
18+
{
19+
frame.setBounds(150,90,1000,600);
20+
frame.setVisible(true);
21+
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
22+
con.setLayout(null);
23+
con.setBackground(Color.YELLOW);
24+
25+
Font f=new Font("Time New Roman",Font.BOLD,30);
26+
lmainhead=new JLabel("JDBC Demo");
27+
lmainhead.setBounds(395,5,400,35);
28+
lmainhead.setFont(f);
29+
con.add(lmainhead);
30+
31+
lname= new JLabel("Name");
32+
lname.setBounds(50,50,60,30);
33+
con.add(lname);
34+
35+
lemail=new Jlabel("Email");
36+
lname.setBounds(50,250,60,30);
37+
con.add(lemail);
38+
39+
lmobile =new JLabel("Mobile No");
40+
lname.setBounds(50,100,60,30);
41+
con.add(lmobile);
42+
43+
lgender=new JLabel("Password");
44+
lgender.setBounds(50,150,60,30);
45+
con.add(lgender);
46+
47+
ldob=new JLabel("DOB");
48+
ldob.setBounds(50,150,60,30);
49+
con.add(ldob);
50+
51+
lpassword =new JLabel("Password");
52+
lpassword.setBounds(50,300,60,30);
53+
con.add(lpassword);
54+
55+
tname= new JTextField();
56+
tname.setBounds(130,53,180,20);
57+
con.add(tname);
58+
59+
r1=new JRadioButton("Male");
60+
r1.setBounds(130,103,80,30);
61+
r1.setBackground(Color.Yellow);
62+
con.add(r1);
63+
64+
r2=new JRadioButton("Female");
65+
r2.setBounds(230,103,80,30);
66+
r2.setBackground(Color.YELLOW);
67+
con.add(r2);
68+
69+
gender.add(r1);
70+
gender.add(r2);
71+
72+
temail =new JTextField();
73+
temail.setBounds(130,253,180,20);
74+
con.add(temail);
75+
76+
tmobile=new JTextField();
77+
tmobile.setBounds(130,203,180,20);
78+
con.add(tmobile);
79+
80+
pass =new JPasswordField();
81+
pass.setBounds(130,303,180,20);
82+
con.add(pass);
83+
84+
String[] daylist= new String[31];
85+
for(int i=1;i<=31;i++)
86+
{
87+
daylist[i-1]=Integer.toString(i);
88+
}
89+
day = new JComboBox(dailist);
90+
day.setBounds(130,153,40,25);
91+
day.setEditable(true);
92+
con.add(day);
93+
94+
String[] monthlist={"Jan", "feb","mar","apr","may","jun","jul","aug","sep","oct","nov","Dec"};
95+
month = new JComboBox(monthlist);
96+
month.setBounds(185,153,50,25);
97+
month.setEditable(true);
98+
conn.add(month);
99+
100+
String[] yearlist =new String[100];
101+
for(int i=1;i<=100;i++)
102+
{
103+
daylist[i-1951]=Integer.toString(i);
104+
}
105+
year =new JComboBox(yearlist);
106+
year.setBounds(250,153,60,25);
107+
year.setEditable(true);
108+
con.add(year);
109+
110+
term = new JCheckBox("I accept term and Conditions");
111+
term.setBounds();
112+
113+
}
114+
}

Swap_number.class

1.08 KB
Binary file not shown.

Swap_number.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.Scanner;
2+
3+
class Swap_number{
4+
public static void main(String args[]){
5+
Scanner obj= new Scanner(System.in);
6+
int a,b;
7+
System.out.println("Enter the Value of A");
8+
a=obj.nextInt();
9+
System.out.println("Enter The Value of B");
10+
b=obj.nextInt();
11+
int temp;
12+
temp=a;
13+
a=b;
14+
b=temp;
15+
System.out.println("A is "+a+"B is "+b);
16+
}
17+
}
997 Bytes
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Using Iteration Method
2+
class Sum_Of_First_10_Natural_Number{
3+
4+
5+
// Creating Class
6+
public static void main(String args[]) {
7+
// Creating main Class
8+
9+
int i;
10+
float sum=0;
11+
// Running Loop
12+
for(i=1;i<=10;i++)
13+
{
14+
sum=sum+i;
15+
System.out.println(i);
16+
}
17+
System.out.println("Sum is :"+sum);
18+
}
19+
}

WAP_3_N_terms_Sum.class

1.21 KB
Binary file not shown.

WAP_3_N_terms_Sum.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.Scanner;
2+
class sum_n_term{
3+
public static void main(String args[]) {
4+
Scanner obj=new Scanner(System.in);
5+
int number,k;
6+
float sum=0;
7+
System.out.print("Enter The Length of Number");
8+
number=obj.nextInt();
9+
System.out.print("Enter The Element :\n");
10+
for(int i=1;i<=number;i++)
11+
{
12+
k=obj.nextInt();
13+
sum=sum+k;
14+
}
15+
System.out.println("\n "+number+" Sum is "+sum);
16+
}
17+
}

WAP_4_Sum_and_Avg_of_N_Number.class

1.21 KB
Binary file not shown.

WAP_4_Sum_and_Avg_of_N_Number.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import java.util.Scanner;
2+
class Sum_and_Avg_of_N_Number{
3+
public static void main(String args[])
4+
{
5+
Scanner obj=new Scanner(System.in);
6+
int i,n;
7+
float elemens,sum=0,avg=0;
8+
System.out.println("Enter the Length of Elements");
9+
n=obj.nextInt();
10+
for(i=1;i<=n;i++)
11+
{
12+
elemens=obj.nextInt();
13+
sum=sum+elemens;
14+
}
15+
avg=sum/n;
16+
System.out.println("All Element Sum :"+sum+"\nAverage is :"+avg);
17+
}
18+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class WAP_sum_of_first_ten_digit_nautral_number{
2+
public static void main(String args[]){
3+
int i;
4+
for(i=1;i<=10;i++)
5+
{
6+
System.out.println(i);
7+
}
8+
9+
10+
}
11+
12+
}
503 Bytes
Binary file not shown.

numan.class

1.09 KB
Binary file not shown.

numan.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import java.util.Scanner;
2+
class numan{
3+
public static void main(String args[]){
4+
Scanner input=new Scanner(System.in);
5+
System.out.println("Enter the value of the A");
6+
int a=input.nextInt();
7+
System.out.println("Your ENter the value "+a);
8+
9+
while(a!=29){
10+
System.out.println(a++);
11+
}
12+
}
13+
}

thirdpower.class

647 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)