Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Class for the Bronze Account
- public class BronzeAccount {
- //attributes
- protected double weekday;
- protected double weekend;
- protected double megabytes;
- //calculations
- public double getTotalCostDay(){
- return weekday*0.12;
- }
- public double getTotalCostEnd(){
- return weekend*0.05;
- }
- public double geTotalCostMB(){
- if (megabytes <= 500){
- return 0.00;
- }else {
- return (megabytes - 500)*0.02;
- }
- }
- public double geTotalCost(){
- return 36 + getTotalCostDay() + getTotalCostEnd() + geTotalCostMB();
- }
- public BronzeAccount (double wd, double we, double mb){
- weekday = wd;
- weekend = we;
- megabytes = mb;
- System.out.println("Account Summary for Bronze Account");
- System.out.println("Package Cost: 36.00");
- System.out.println("Cost of daytime calls: 0.12/min");
- System.out.println("Cost of evening and weekend calls: 0.05/min");
- System.out.println("Number of Channels: 60");
- System.out.println("Broadband Included: 500Mb");
- System.out.printf("Total daytime calls cost:%.2f\n",getTotalCostDay());
- System.out.printf("Total evening calls cost:%.2f\n",getTotalCostEnd());
- System.out.printf("Total (extra) broadband cost:%.2f\n",geTotalCostMB());
- System.out.printf("Total cost:%.2f\n",geTotalCost());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement