Advertisement
Kawsar_Hossain

UML107

Feb 22nd, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1.  
  2. public class User {
  3.     protected String userid;
  4.     protected String passwd;
  5.     public User(String userid,String passwd)
  6.     {
  7.         this.userid=userid;
  8.         this.passwd=passwd;
  9.     }
  10.     public void display(String n,String e)
  11.     {
  12.         System.out.println("User Id: "+userid);
  13.         System.out.println("Pssword: "+passwd);
  14.         System.out.println("Name: "+n);
  15.         System.out.println("Email: "+e);
  16.     }
  17. }
  18.  
  19.  
  20.  
  21. public class Item {
  22.     protected String itemName;
  23.     protected double price;
  24.     public Item(String i,double b)
  25.     {
  26.         itemName=i;
  27.         price=b;
  28.     }
  29.     public void display()
  30.     {
  31.         System.out.println("Item Name :"+itemName);
  32.         System.out.println("Price :"+price);
  33.     }
  34. }
  35.  
  36.  
  37.  
  38. public class Customer extends User{
  39.     private static String name;
  40.     private static String email;
  41.    
  42.     public Customer(String n,String e)
  43.     {
  44.         super("kawsar121","errwe");
  45.         name=n;
  46.         email=e;
  47.        
  48.     }
  49.     public static void main(String[] args) {
  50.         Customer o1 = new Customer("Kawsar","kawsar@gmail.com");
  51.         Item ob2 = new Item("Jharu",50);
  52.         ob2.display();
  53.         o1.display(name,email);
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement