Arifin99

OOD

Oct 4th, 2020
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.46 KB | None | 0 0
  1. package studentmanagementsystem;
  2.  
  3. public class Student {
  4.  
  5.     private String name;
  6.     private String id;
  7.     private double cgpa;
  8.     private int registrationFee;
  9.  
  10.     public Student(String name, String id, double cgpa, int registrationFee) {
  11.         this.name = name;
  12.         this.id = id;
  13.         this.cgpa = cgpa;
  14.         this.registrationFee = registrationFee;
  15.     }
  16.  
  17.     public String getName() {
  18.         return name;
  19.     }
  20.  
  21.     public String getId() {
  22.         return id;
  23.     }
  24.  
  25.     public double getCgpa() {
  26.         return cgpa;
  27.     }
  28.  
  29.     public int getRegistrationFee() {
  30.         return registrationFee;
  31.     }
  32.  
  33.     void giving_online_exam() {
  34.         System.out.println("Online exam");
  35.     }
  36.  
  37.     String attendingOnlineClass() {
  38.         return "attending online classes.";
  39.     }
  40.  
  41. }
  42.  
  43.  
  44.  
  45.  
  46.  
  47. package studentmanagementsystem;
  48.  
  49. public class Admin {
  50.  
  51.     void givingWavier(Student studentName) {
  52.         if (studentName.getCgpa() > 3.8) {
  53.             System.out.println(studentName.getName() + " recieve 10% waiver");
  54.         }
  55.     }
  56.  
  57.     void givingRegistraionClearance(Student studentName) {
  58.         if (studentName.getRegistrationFee() >= 13500) {
  59.             System.out.println(studentName.getName() + " clearance done");
  60.         } else {
  61.             System.out.println(studentName.getName() + " clearance incomplete");
  62.         }
  63.     }
  64. }
  65.  
  66.  
  67.  
  68.  
  69. package studentmanagementsystem;
  70.  
  71. public class StudentManagementSystem {
  72.  
  73.     public static void main(String[] args) {
  74.        
  75.         Student arifin = new Student("Arifin", "192-35-2861", 3.88, 10000);
  76.         System.out.println("Name - " + arifin.getName() + " ID -" + arifin.getId()
  77.                 + " GGPA -" + arifin.getCgpa());
  78.         Student joy = new Student("joy", "192-35-2877", 3.68, 20000);
  79.         System.out.println("Name - " + joy.getName() + " ID -" + joy.getId()
  80.                 + " GGPA -" + joy.getCgpa());
  81.         Student ali = new Student("Ali", "192-35-2866", 3.98, 15000);
  82.         System.out.println("Name - " + ali.getName() + " ID -" + ali.getId()
  83.                 + " GGPA -" + ali.getCgpa());
  84.  
  85.         Admin farzanaMam = new Admin();
  86.        
  87.         farzanaMam.givingWavier(arifin);
  88.         farzanaMam.givingWavier(ali);
  89.         farzanaMam.givingWavier(joy);
  90.  
  91.         farzanaMam.givingRegistraionClearance(arifin);
  92.         farzanaMam.givingRegistraionClearance(joy);
  93.         farzanaMam.givingRegistraionClearance(ali);
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment