Sajib_Ahmed

Untitled

Mar 2nd, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1.  
  2. package javaapplication9;
  3.  
  4.  
  5. public abstract class User {
  6.  
  7. protected String userid,password;
  8.  
  9.  
  10. public User(String userid, String password) {
  11. this.userid = userid;
  12. this.password = password;
  13. }
  14.  
  15.  
  16. public void display()
  17. {
  18. System.out.println(userid+"\n"+password);
  19. }
  20.  
  21. }
  22.  
  23. package javaapplication9;
  24.  
  25.  
  26. public class Customer extends User{
  27. private String name,email;
  28.  
  29. public Customer(String c,String d)
  30. {
  31. super("1u23","saji89");
  32. name=c;
  33. email=d;
  34. System.out.println(name+"\n"+email);
  35. }
  36. public static void main(String[] args)
  37. {
  38.  
  39. Customer obj=new Customer("Sajib Ahmed Shanto","[email protected]");
  40. obj.display();
  41.  
  42.  
  43. Item ob1=new Item("aaaaaa",200.00);
  44. ob1.display();
  45. }
  46.  
  47.  
  48. }
  49.  
  50. package javaapplication9;
  51.  
  52.  
  53. public class Item {
  54. private String itename;
  55. private double price;
  56. public Item(String l,double i)
  57. {
  58. itename=l;
  59. price=i;
  60. }
  61. public void display()
  62. {
  63. System.out.println(itename+"\n"+price);
  64.  
  65. }
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment