pastebin

Paste Search Dynamic
Recent pastes
User
  1. class User{
  2.    string userName, password, name, userType;
  3.    public User(string userName, string password, string name, string userType) {
  4.        this.userName = userName;
  5.        this.password = password;
  6.        this.name = name;
  7.        this.userType = userType;
  8.    }
  9.  
  10.    public void Login() {system.out.println(userName + " is logged in  "+ userType);}
  11.    public void Logout() {system.out.println(userName + " is logged out. See you soon.");}
  12. }
  13.  
  14. class Student extends User
  15. {
  16.    int ID,intake;
  17.    string dept;
  18.    public Student(string userName, string password, string name, string userType, int ID,
  19.    int intake, string dept)
  20.    {
  21.        super(userName, password, name, userType);
  22.        this.ID = ID;
  23.        this.intake = intake;
  24.        this.dept = dept;
  25.        this.userType = "1";
  26.    }
  27.    public void courseReg()
  28.    {
  29.        system.out.println("Id: "+ID+"nintake "+intake + "nName: "+name+"nUser Type: "+userType);
  30.    }
  31. }
  32.  
  33. class Faculty extends User{
  34.    string shortCode,dept;
  35.    int roomNo;
  36.    public Faculty(string userName, string password, string name, string userType, string
  37.    shortCode, string dept, int roomNo) {
  38.        super(userName, password, name, userType);
  39.        this.shortCode = shortCode;
  40.        this.dept = dept;
  41.        this.roomNo = roomNo;
  42.    }
  43.    void supervise(){
  44.        system.out.println("Project: "Attendance system" is supervised by "+name+"" +
  45.                        "nDept of: "+dept+
  46.                "nRoom No: "+roomNo);
  47.    }
  48. }
  49.  
  50. class Admin extends User{
  51.    int roomNo;
  52.    public Admin(string userName, string password, string name, string userType, int
  53.    roomNo) {
  54.        super(userName, password, name, userType);
  55.        this.roomNo = roomNo;
  56.    }
  57.    void add(){
  58.        system.out.println("Add New faculty Member");
  59.    }
  60.    void delete(){
  61.        system.out.println("Delete old faculty Member");
  62.    }
  63. }
  64.  
  65.  class Main{
  66.    public static void main(string[] args) {
  67.        Student s = new Student("Nabil", "20211203047","Nabil Rahman" , "student", 202203047, 37, "CSE");
  68.        s.Login();
  69.        s.courseReg();
  70.        s.Logout();
  71.        system.out.println();
  72.  
  73.        Faculty f = new Faculty("Sumi khatun","12345","","faculty","SKN","CSE",331);
  74.        f.Login();
  75.        f.supervise();
  76.        f.Logout();
  77.        system.out.println();
  78.  
  79.        Admin a = new Admin("admin@gmail.com","2022","Admin","admin",310);
  80.        a.Login();
  81.        a.add();
  82.        a.delete();
  83.        a.Logout();
  84.    }
  85. }
  86.  
Parsed in 0.156 seconds