Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. //Class for the Bronze Account
  2. public class BronzeAccount {
  3. //attributes
  4. protected double weekday;
  5. protected double weekend;
  6. protected double megabytes;
  7.  
  8. //calculations
  9. public double getTotalCostDay(){
  10. return weekday*0.12;
  11. }
  12. public double getTotalCostEnd(){
  13. return weekend*0.05;
  14. }
  15. public double geTotalCostMB(){
  16. if (megabytes <= 500){
  17. return 0.00;
  18. }else {
  19. return (megabytes - 500)*0.02;
  20. }
  21. }
  22. public double geTotalCost(){
  23. return 36 + getTotalCostDay() + getTotalCostEnd() + geTotalCostMB();
  24. }
  25.  
  26.  
  27.  
  28. public BronzeAccount (double wd, double we, double mb){
  29. weekday = wd;
  30. weekend = we;
  31. megabytes = mb;
  32.  
  33. System.out.println("Account Summary for Bronze Account");
  34. System.out.println("Package Cost: 36.00");
  35. System.out.println("Cost of daytime calls: 0.12/min");
  36. System.out.println("Cost of evening and weekend calls: 0.05/min");
  37. System.out.println("Number of Channels: 60");
  38. System.out.println("Broadband Included: 500Mb");
  39. System.out.printf("Total daytime calls cost:%.2f\n",getTotalCostDay());
  40. System.out.printf("Total evening calls cost:%.2f\n",getTotalCostEnd());
  41. System.out.printf("Total (extra) broadband cost:%.2f\n",geTotalCostMB());
  42. System.out.printf("Total cost:%.2f\n",geTotalCost());
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement