Skip to content

Commit

Permalink
exp update
Browse files Browse the repository at this point in the history
  • Loading branch information
AkashKobal committed Mar 26, 2024
1 parent 666822d commit 78218af
Show file tree
Hide file tree
Showing 45 changed files with 534 additions and 0 deletions.
10 changes: 10 additions & 0 deletions EXPERIMENT1/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions EXPERIMENT1/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>EXPERIMENT1</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions EXPERIMENT1/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
14 changes: 14 additions & 0 deletions EXPERIMENT1/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Binary file added EXPERIMENT1/bin/EXPERIMENT1/Deserial.class
Binary file not shown.
Binary file added EXPERIMENT1/bin/EXPERIMENT1/Serial.class
Binary file not shown.
Binary file added EXPERIMENT1/bin/EXPERIMENT1/Student.class
Binary file not shown.
Binary file added EXPERIMENT1/bin/module-info.class
Binary file not shown.
26 changes: 26 additions & 0 deletions EXPERIMENT1/src/EXPERIMENT1/Deserial.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package EXPERIMENT1;

import java.io.*;
class Deserial {
public static void main(String args[]){
try{
FileInputStream fin = new FileInputStream("d:\\f.txt");
ObjectInputStream in=new ObjectInputStream(fin);
Student s1=(Student)in.readObject();
Student s2=(Student)in.readObject();
Student s3=(Student)in.readObject();
Student s4=(Student)in.readObject();
Student s5=(Student)in.readObject();


System.out.println(s1);
System.out.println(s2);
System.out.println(s3);
System.out.println(s4);
System.out.println(s5);
in.close();
}catch(Exception e){
System.out.println(e);
}
}
}
28 changes: 28 additions & 0 deletions EXPERIMENT1/src/EXPERIMENT1/Serial.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package EXPERIMENT1;

import java.io.*;
class Serial{
public static void main(String args[]){
try
{
Student s1 =new Student(1,"ram", 1000);
Student s2 =new Student(2,"shyam", 2000);
Student s3 =new Student(3,"mohan", 3000);
Student s4 =new Student(4,"sohan", 4000);
Student s5 =new Student(5,"mohan", 5000);
FileOutputStream fout=new FileOutputStream("d:\\f.txt");
ObjectOutputStream out=new ObjectOutputStream(fout);
out.writeObject(s1);
out.writeObject(s2);
out.writeObject(s3);
out.writeObject(s4);
out.writeObject(s5);
out.flush();
out.close();
System.out.println("success");
}
catch(Exception e){
System.out.println(e);
}
}
}
18 changes: 18 additions & 0 deletions EXPERIMENT1/src/EXPERIMENT1/Student.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package EXPERIMENT1;

import java.io.Serializable;

public class Student implements Serializable {
int rno;
String name;
float fees;
public Student(int id1, String name1, float fees1) {
this.rno = id1;
this.name = name1;
this.fees = fees1;
}
public String toString() {
return rno + " " + name +" " + fees +"\n";
}
}

8 changes: 8 additions & 0 deletions EXPERIMENT1/src/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
*
*/
module EXPERIMENT1 {
}
10 changes: 10 additions & 0 deletions EXPERIMENT2/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions EXPERIMENT2/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>EXPERIMENT2</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions EXPERIMENT2/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
14 changes: 14 additions & 0 deletions EXPERIMENT2/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Binary file added EXPERIMENT2/bin/EXPERIMENT2/AgeComparator.class
Binary file not shown.
Binary file added EXPERIMENT2/bin/EXPERIMENT2/FeesComparator.class
Binary file not shown.
Binary file added EXPERIMENT2/bin/EXPERIMENT2/NameComparator.class
Binary file not shown.
Binary file added EXPERIMENT2/bin/EXPERIMENT2/SalaryComparator.class
Binary file not shown.
Binary file added EXPERIMENT2/bin/EXPERIMENT2/Student.class
Binary file not shown.
Binary file added EXPERIMENT2/bin/EXPERIMENT2/TEMP1.class
Binary file not shown.
Binary file added EXPERIMENT2/bin/module-info.class
Binary file not shown.
77 changes: 77 additions & 0 deletions EXPERIMENT2/src/EXPERIMENT2/Student.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package EXPERIMENT2;

import java.io.*;
import java.util.*;

class Student {
int rollno;
String name;
float fees;
String branch;
int year;
int sem;
int age;
static String clg;
float salary;

public Student(int rollno,String name,float fees,String branch,int year,int sem,int age,float salary) {
this.rollno = rollno;
this.name = name;
this.fees = fees;
this.branch = branch;
this.year = year;
this.sem = sem;
this.age = age;
clg="PU";
this.salary=salary;
}
@Override
public String toString() {
return rollno + " "+ name + " " + fees + " " + branch + " " + year + sem + " " + age + " " + clg + " "+salary+"\n";
}
}
class AgeComparator implements Comparator {
public int compare(Object o1, Object o2) {
Student s1=(Student)o1;
Student s2=(Student)o2;
if(s1.age==s2.age)
return 0;
else if(s1.age>s2.age)
return 1;
else
return -1;
}
}
class SalaryComparator implements Comparator{
public int compare(Object o1, Object o2) {
Student s1 = (Student) o1;
Student s2 = (Student) o2;
if (s1.salary == s2.salary)
return 0;
else if (s1.salary > s2.salary)
return 1;
else
return -1;
}
}

class NameComparator implements Comparator{
public int compare(Object o1, Object o2) {
Student s1=(Student)o1;
Student s2=(Student)o2;
return s1.name.compareTo(s2.name);
}
}
class FeesComparator implements Comparator {
public int compare(Object o1,Object o2) {
Student s1=(Student)o1;
Student s2=(Student)o2;
if(s1.fees==s2.fees)
return 0;
else if(s1.fees>s2.fees)
return 1;
else
return -1;
}
}

53 changes: 53 additions & 0 deletions EXPERIMENT2/src/EXPERIMENT2/TEMP1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package EXPERIMENT2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

public class TEMP1 {

public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList sl=new ArrayList();
sl.add(new Student(1,"Shiva",10000.00f,"cse",1,1,18,20000.00f));
sl.add(new Student(2,"Venky",15000.00f,"ise",1,2,20,25000.00f));
sl.add(new Student(3,"Jesus",17000.00f,"ece",1,1,19,30000.00f));
sl.add(new Student(3,"Alla",12000.00f,"eee",1,1,19,30000.00f));
sl.add(new Student(3,"Budha",11000.00f,"mech",1,1,21,30000.00f));
System.out.println("Sorting by Name");
System.out.println("_______________");
Collections.sort(sl,new NameComparator());
Iterator itr=sl.iterator();
while(itr.hasNext()){
Student st=(Student)itr.next();
System.out.println(st);
}
System.out.println("Sorting by age");
System.out.println("______________");
Collections.sort(sl,new AgeComparator());
Iterator itr2=sl.iterator();
while(itr2.hasNext()) {
Student st=(Student)itr2.next();
System.out.println(st );
}
System.out.println("Sorting by fees");
System.out.println("______________");
Collections.sort(sl,new FeesComparator());
Iterator itr1=sl.iterator();
while(itr1.hasNext()){
Student st=(Student)itr1.next();
System.out.println(st);
}
System.out.println("Sorting by salary");
System.out.println("______________");
Collections.sort(sl,new SalaryComparator());
Iterator itr3=sl.iterator();
while (itr3.hasNext()) {
Student st = (Student) itr3.next();
System.out.println(st);
}
}


}

8 changes: 8 additions & 0 deletions EXPERIMENT2/src/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
*
*/
module EXPERIMENT2 {
}
11 changes: 11 additions & 0 deletions EXPERIMENT3/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="C:/Users/Admin/Downloads/mysql-connector-j-8.3.0/mysql-connector-j-8.3.0/mysql-connector-j-8.3.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions EXPERIMENT3/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>EXPERIMENT3</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions EXPERIMENT3/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
14 changes: 14 additions & 0 deletions EXPERIMENT3/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Binary file added EXPERIMENT3/bin/jdbc/Temp2.class
Binary file not shown.
Binary file added EXPERIMENT3/bin/module-info.class
Binary file not shown.
Loading

0 comments on commit 78218af

Please sign in to comment.