Assignment 2 Solution
Assignment 2 Solution
UW
Assigned Date: 30-10 – 19
ASSIGNMENT 2
You need to write code for a Salon Service. For better customer management the Salon has divided
the customers into two classes; Customer and PremiumCustomer. The track of ordinary customers in
not maintained whereas the premium customers have a maintained history. Premium customer are
also able to get a discount of 20% in each purchase.
return "Date:"+day+"\\"+month+"\\"+year+
"\nService Charges: "+serviceCharges+"\nProduct Charges: "+productCharges;
}
/**@author Aslam*/
double getTotalExpense(){
return((visit.get(0).serviceCharges)+(visit.get(0).productCharges));
}
System.out.println("\nVisit No:"+k);
System.out.println(i.toString());
k++;
}
// System.out.println("No of visits: "+getTotalNoOfVisit());
}
double getTotalExpense(){
int lastVisit=visit.size()-1;
System.out.println("sc"+super.visit.get(lastVisit).serviceCharges+"pc"+super.visit.get(lastVisit).pr
oductCharges+"v"+(double)getTotalNoOfVisit()/100);
double total= (super.visit.get(lastVisit).serviceCharges+super.visit.get(lastVisit).productCharges) ;
return discount(total);
}
@Override
public double discount(double amount) {
return amount-amount*discountRate;
}
}
/**@author Aslam */
p1.addVisit(d1,400,200);
System.out.println("BILL");
p1.printBill();
System.out.println("CUSTOMER HISTORY");
p1.getCustomerHistory();
}
}
Output :