Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class Person
- {
- protected String first,last,email;
- public Person()
- {
- setFirst("");
- setLast("");
- setEmail("");
- }
- public Person(String first,String last,String email)
- {
- setFirst(first);
- setLast(last);
- setEmail(email);
- }
- public abstract String getDisplayText();
- public String getFirst(){return this.first;}
- public void setFirst(String first){this.first=first;}
- public String getLast(){return this.last;}
- public void setLast(String last){this.last=last;}
- public String getEmail(){return this.email;}
- public void setEmail(String email){this.email=email;}
- @Override
- public String toString()
- {
- String msg = "Name: " + this.getFirst() + this.getLast() + "\n" +
- "Email: " + this.getEmail();
- return msg;
- }
- }//End Class
- class Customer extends Person
- {
- private String num;
- public Customer()
- {
- super();
- setNum("");
- }
- public Customer(String first,String last,String email,String num)
- {
- super(first,last,email);
- setNum(num);
- }
- public String getNum(){return this.num;}
- public void setNum(String num){this.num=num;}
- @Override
- public String toString()
- {
- String msg="Name: " + this.getFirst() + this.getLast() + "\n" +
- "Email :" + this.getEmail() + "\n" +
- "Customer Number: " + this.getNum();
- return msg;
- }
- @Override
- public String getDisplayText()
- {
- return this.toString();
- }
- }//end Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement