Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tip, Tax, and Total Problem: Create a JavaFX application that lets the user enter the food charge for a meal at a restaurant. When a

Tip, Tax, and Total Problem: Create a JavaFX application that lets the user enter the food charge for a meal at a restaurant. When a button is clicked, the application should calculate and display the amount of an 18 percent tip, 7 percent sales tax, and the total of all three amounts.

I need an html file with this, I don't know how to go about doing that. This is what I have for the program and it works just fine, I just don't know how to make the html file or incorporate it into my java file. Can someone help me?

------------------------------------------------------------------------------------------------------

package WordNode;

import java.awt.Button; import java.util.Scanner;

public class TipTaxTotal {

public static void main(String [] args) { double charge; double tax = 0.07; double tipRate = 0.18; double totalWithTax; double taxAmount; double tipAmount; double grandTotal; Scanner keyboard = new Scanner(System.in); //ask for charge from the user System.out.println("What is the charge for your meal?"); charge = keyboard.nextDouble(); //calculate the charge and the tip taxAmount = charge * tax; totalWithTax = charge + taxAmount; tipAmount = totalWithTax * tipRate; grandTotal = totalWithTax + tipAmount; //Display it back to the user System.out.println("meal: $" + charge); System.out.println("tax: $" + taxAmount); System.out.println("meal + tax: $" + totalWithTax); System.out.println("total cost(tip included): $" + grandTotal); }

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions