0
 {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+ 
        formatter.format(billtip)); 

    }
}

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

3
Contributors
2
Replies
16
Views
7 Months
Discussion Span
Last Post by Reverend Jim
1
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;

Edited by Reverend Jim

Votes + Comments
With tax as mentioned in the println() in the next line,
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.