{public RestaurantBill()
        //Create DecimalFormat object
        DecimalFormat formatter = new Decimal("#0.00"); 

        // Initialise instance variables
        //Declaring variable(s). 
        double bill= 0.00; 
        double billtip= 0.00; 
        double billtax= 0.00;
        double total= 0.00; 

        //Initializing variables.
        //Obtaining user's current amount without tax and tip.  
        System.out.println("Enter the amount of your restaurant bill.");
        bill = input.nextDouble();

        //Calculating the bill with tax. 
        billtax= bill *6.75;
        System.out.println("Here is your bill with tax " + billtax); 

        //Calculating the bill(with tax) and tip. 
        billtip= billtax * .15; 
        System.out.println("Here is what your bill with tax and tip included"); 

        //Printing total amount of the user's bill to the console. 
        total= billtip; 
        System.out.println("Here is your bill (tax and tip included)"+ total+ 


Please help and I'm trying my best with this code but I still have some errors.

Recommended Answers

All 2 Replies

Don't expect us to guess - tell us exactly what problems you are having difficulty with.

billtax= bill *6.75;

I'm assuming that tax here is 6.75%. What you have coded is actually 675%. I think you want

billtax= bill *.0675;

and if billtax is bill + tax then

billtax= bill * 1.0675;
commented: With tax as mentioned in the println() in the next line, +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.