Walkerbo

Faculty - FacultyList

Aug 20th, 2013
47
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //  My faculty Class in Objects package -------------------------------------
  2.  
  3. public class Faculty {
  4.    
  5.     private String FacultyName;
  6.     private String FacultyDescription;
  7.     private int FacultyPointCap;   
  8.    
  9.     public Faculty (String facultyName, String facultyDescription, int facultyPointCap){
  10.         facultyName=FacultyName;
  11.         facultyDescription=FacultyDescription;
  12.         facultyPointCap=FacultyPointCap;
  13.     }
  14.  
  15.     public String getFacultyName() {
  16.         return FacultyName;
  17.     }
  18.     public void setFacultyName(String facultyName) {
  19.         FacultyName = facultyName;
  20.     }
  21.     public String getFacultyDescription() {
  22.         return FacultyDescription;
  23.     }
  24.     public void setFacultyDescription(String facultyDescription) {
  25.         FacultyDescription = facultyDescription;
  26.     }
  27.     public int getFacultyPointCap() {
  28.         return FacultyPointCap;
  29.     }
  30.     public void setFacultyPointCap(int facultyPointCap) {
  31.         FacultyPointCap = facultyPointCap;
  32.     }
  33. //  public String toString() {
  34. //      return "Faculty [FacultyName=" + FacultyName + ", Facultydescription="
  35. //              + Facultydescription + ", FacultyPointCap=" + FacultyPointCap
  36. //              + "Faculty Class]";
  37. //  }
  38. }
  39.  
  40. //  My FacultyList Class in my Values package---------------------------------------------
  41.  
  42. public class FacultyList {
  43.    
  44.     public static List <Faculty> CurrentFacultyList = new ArrayList<Faculty>() {{
  45.        
  46.         add(new Faculty("FacultyNameTest1",
  47.                 "FacultyDescriptionTest1",
  48.                 100));
  49.         add(new Faculty("FacultyNameTest2",
  50.                 "FacultyDescriptionTest2"
  51.                 ,200));
  52.         }};
  53.  
  54.  
  55.     public static List<Faculty> getCurrentFacultyList() {
  56.         return CurrentFacultyList;
  57.     }
  58.     public static void setCurrentFacultyList(List<Faculty> currentFacultyList) {
  59.         CurrentFacultyList = currentFacultyList;
  60.     }
  61.     public String toString() {
  62.         return "FacultyList [getClass()=" + getClass() + ", hashCode()="
  63.                 + hashCode() + ", toString()=" + super.toString() + "  FacultyListClass]";
  64.     }
  65.  
  66. // My StartTest --------------------------------------------------------
  67.  
  68. public class StartTest {   
  69.    
  70.     public static void main(String[] args) {
  71.  
  72.     // test string for facultylist ------------------------------------------------------------------  
  73.  
  74.         int Count = 1;
  75.        
  76.         for (int QQ = 0; QQ<FacultyList.CurrentFacultyList.size(); QQ++){          
  77.                        
  78.             Faculty Fac = (Faculty)FacultyList.CurrentFacultyList.get(QQ);
  79.            
  80.             String FacS = (String)Fac.toString();
  81.  
  82.             System.out.println(Count + "  -  " + Fac + "  -  " + FacS);
  83.             Count++;           
  84.         }  
  85.     }
  86. }
  87.  
  88.  
  89. //   Console output -------------------------------------------
  90. 1  -  cabbage.model.entities.Faculty@72423da9  -  cabbage.model.entities.Faculty@72423da9
  91. 2  -  cabbage.model.entities.Faculty@5ade5cd9  -  cabbage.model.entities.Faculty@5ade5cd9
RAW Paste Data