Commit d7a7742a authored by Suresh Kumar's avatar Suresh Kumar

Refactor

parent 6389c1da
package task1.multipleFileExample;
//import java.util.*;
public class Department {
private int id;
private String name;
......
......@@ -3,7 +3,7 @@ import java.util.*;
public class Employee {
Scanner sc = new Scanner(System.in);
private Integer id ;
private int id ;
private String name;
private String department;
......@@ -13,7 +13,7 @@ public class Employee {
public Integer getId() {
return id;
}
public void setId(Integer id) {
public void setId(int id) {
this.id = id; }
public String getName() {
......
package task1.multipleFileExample;
import java.util.*;
public class Student {
// Scanner in = new Scanner(System.in);
int id ;
String name;
String department;
......
package task1.multipleFileExample;
import java.util.*;
public class Test {
//Scanner in = new Scanner(System.in);
public static void main(String [] args){
Employee e = new Employee();
/*ß
e.setId(153);
System.out.println("Your id Number is " +e.getId());
e.setName("Suresh Kumar");
System.out.println("Your Name is " + e.getName());
e.setDepartment("Information Technology");
System.out.println("Your Department is " + e.getDepartment());
e.setAddress("Akhtar Colony Karachi");
System.out.println("Your Address is " + e.getAddress());*/
Student s = new Student();
s.id= 153; System.out.println("Your id Numbr is " + s.id);
s.name ="Mr Suresh Kumar";
......@@ -36,13 +16,6 @@ public class Test {
s.address ="Akhtar Colony Kerachi";
System.out.println("Your name is " + s.address);
System.out.println("Task Completed ");
}
}
......@@ -2,9 +2,7 @@ package task1.singleFile;
import java.util.*;
public class Encap {
Scanner in = new Scanner(System.in);
private String name= in.nextLine();
private int roll= in.nextInt();
......@@ -12,27 +10,19 @@ public class Encap {
this.name = name;
}
public String getName() {
return name;
}
public void setRoll(int roll) {
this.roll = roll;
}
public int getRoll() {
return roll;
}
public static void main (String []args){
Encap student = new Encap();
System.out.println( "Student Name = " + student.getName() );
System.out.println( "Student Roll Number " +student.getRoll() );
System.out.println( "Student Roll Number " +student.getRoll() );
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment