3 /** 4 * @Encapsulation testing java OOP - LAB2 5 * @author Amila 6 */ 7 public class Encaps { 8 /** 9 * @param args the command line arguments 10 */ 11 public static void main(String[] args) { 12 Student nalaka = new Student(); 13 setStudent(nalaka,"Nalaka",35,67,true); 14 DisplayStudent(nalaka); 15 16 Student janith = new Student(); 17 setStudent(janith,"Janith",38,58,true); 18 DisplayStudent(janith); 19 } 20 21 private static void setStudent(Student s,String name,int age,int marks,boolean isMale){ 22 s.setName(name); 23 s.setAge(age); 24 s.setMarks(marks); 25 s.setisMail(isMale); 26 } 27 private static void DisplayStudent(Student s){ 28 String sex; 29 if (s.getisMail()) 30 sex="Male"; 31 else 32 sex="Female"; 33 34 System.out.println("\n=================================="+ 35 "\nStudent Name: "+ s.getName() + 36 "\nStudent Age: "+s.getAge()+ 37 "\nStudent Marks: "+s.getMarks()+ 38 "\nStudent Sex: "+sex+ 39 "\n=================================="); 40 } 41 } 42 class Student{ 43 44 private static int count=0; 45 private String Name; 46 private int Age; 47 private int Marks; 48 private boolean isMale; 49 50 public Student(){ 51 this.count++; 52 System.out.println("\nStudent count is "+ this.count); 53 } 54 public void setName(String name){ 55 this.Name=name; 56 } 57 public String getName(){ 58 return this.Name; 59 } 60 public void setAge(int age){ 61 this.Age=age; 62 } 63 public int getAge(){ 64 return this.Age; 65 } 66 public void setMarks(int marks){ 67 this.Marks=marks; 68 } 69 public int getMarks(){ 70 return this.Marks; 71 } 72 public void setisMail(boolean Mail){ 73 this.isMale=Mail; 74 } 75 public boolean getisMail(){ 76 return this.isMale; 77 }
Diploma in Information Systems and Technology
The Diploma in Information Systems and
Technology (DIST) is your passport to a highly lucrative career in the
IT field. The programme is designed in a way that a student who
successfully completes the Diploma can find a placement immediately in
the IT industry and earn a Bachelor of Software Engineering Degree
(confirming to IEEE/ACM curriculum guidelines) while being employed.
The programme offers a set of carefully
designed industry-oriented subjects that closely align with the needs of
the industry. Special emphasis has been placed to include strong
practical skills as well as soft skills sought by the IT companies.
The programme is delivered through online classes, face-to-face
interaction, laboratory sessions and printed course materials.
Industry-oriented courses are conducted by experts from the industry.