Suppose you have a class called Restaurant with an instance

Suppose you have a class called Restaurant with an instance variable called \"price\" (represented as a double). Write an instance method called calculateBill() that calculates and returns the total bill for a customer, assuming that they leave a 15% tip. Also assume that they pay tax at 8%.

Solution

This is the calculateBill method according to the requirements:

public void calculateBill(double price) {
double price = 100;
double tax = 8;
double tip = 15;
double Total;

   tax = (double) ((8*100)/Price)
   tip = (double) ((15*100)/Price)
   total = Price + tax + tip;
   system.out.println(\"Total Bill is:\" +toatl);
}

Suppose you have a class called Restaurant with an instance variable called \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site