Guest User

Untitled

a guest
Jan 31st, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public interface IUser {
  2. double standardSubcription(int years);
  3. double studentSubcription(int years);
  4. double premiumSubcription(int years);
  5. }
  6.  
  7. public class User implements IUser {
  8. private String name;
  9. private String username;
  10. private String password;
  11.  
  12. private double price = 75;
  13.  
  14. public User(String name, String username, String password) {
  15. this.name = name;
  16. this.username = username;
  17. this.password = password;
  18. }
  19.  
  20. public String getName() {
  21. return name;
  22. }
  23.  
  24. public String getUsername() {
  25. return username;
  26. }
  27.  
  28. public String getPassword() {
  29. return password;
  30. }
  31.  
  32. @Override
  33. public String toString() {
  34. return "User [name=" + name + ", username=" + username + ", password=" + password + "]";
  35. }
  36.  
  37. @Override
  38. public double standardSubcription(int years) {
  39. return price * years;
  40. }
  41.  
  42. @Override
  43. public double studentSubcription(int years) {
  44. return (price * 0.5) *years;
  45. }
  46.  
  47. @Override
  48. public double premiumSubcription(int years) {
  49. return (price * 2) *years;
  50. }
  51.  
  52. }
Add Comment
Please, Sign In to add comment